diff --git a/src/Serval.Translation/Controllers/TranslationEnginesController.cs b/src/Serval.Translation/Controllers/TranslationEnginesController.cs index 4c3efb6f..e4eed780 100644 --- a/src/Serval.Translation/Controllers/TranslationEnginesController.cs +++ b/src/Serval.Translation/Controllers/TranslationEnginesController.cs @@ -984,13 +984,12 @@ private static Build Map(Engine engine, TranslationBuildConfigDto source) } try { - JsonSerializer.Deserialize(source.Options ?? "{}"); + build.Options = JsonConvert.DeserializeObject>(source.Options ?? "{}"); } catch (Exception e) { throw new ArgumentException($"Unable to parse field 'options' : {e.Message}"); } - build.Options = source.Options; return build; } @@ -1030,7 +1029,7 @@ private TranslationBuildDto Map(Build source) Message = source.Message, State = source.State, DateFinished = source.DateFinished, - Options = source.Options + Options = JsonConvert.SerializeObject(source.Options) }; } diff --git a/src/Serval.Translation/Models/Build.cs b/src/Serval.Translation/Models/Build.cs index 5185f64f..d934a35c 100644 --- a/src/Serval.Translation/Models/Build.cs +++ b/src/Serval.Translation/Models/Build.cs @@ -12,5 +12,5 @@ public class Build : IEntity public string? Message { get; set; } public JobState State { get; set; } = JobState.Pending; public DateTime? DateFinished { get; set; } - public string? Options { get; set; } + public IDictionary? Options { get; set; } } diff --git a/src/Serval.Translation/Usings.cs b/src/Serval.Translation/Usings.cs index 2129040f..88dfcf14 100644 --- a/src/Serval.Translation/Usings.cs +++ b/src/Serval.Translation/Usings.cs @@ -11,6 +11,7 @@ global using Microsoft.AspNetCore.Routing; global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.Options; +global using Newtonsoft.Json; global using NSwag.Annotations; global using Serval.Shared.Configuration; global using Serval.Shared.Contracts;