Added more security and metrics

This commit is contained in:
2026-06-22 07:28:03 +02:00
committed by Jeroen Saey
parent 2a1f7b77ee
commit cb2d111ad7
27 changed files with 1638 additions and 884 deletions
+5 -3
View File
@@ -1,5 +1,5 @@
using EonaCat.DoxaApi.Models;
using System.Text.Json;
using EonaCat.Json;
namespace EonaCat.DoxaApi.Interop
{
@@ -10,13 +10,15 @@ namespace EonaCat.DoxaApi.Interop
{
public static ApiDocument Import(string json)
{
return JsonSerializer.Deserialize<ApiDocument>(json)
return JsonHelper.ToObject<ApiDocument>(json)
?? throw new InvalidOperationException("Invalid DoxaApi spec.");
}
public static async Task<ApiDocument> ImportAsync(Stream stream)
{
var doc = await JsonSerializer.DeserializeAsync<ApiDocument>(stream);
using var reader = new StreamReader(stream);
var json = await reader.ReadToEndAsync();
var doc = JsonHelper.ToObject<ApiDocument>(json);
return doc ?? throw new InvalidOperationException("Invalid DoxaApi spec.");
}
}