diff --git a/src/Serval.Client/Client.g.cs b/src/Serval.Client/Client.g.cs index fbe0c85e..54515b40 100644 --- a/src/Serval.Client/Client.g.cs +++ b/src/Serval.Client/Client.g.cs @@ -1015,8 +1015,8 @@ public partial interface ITranslationEnginesClient ///
you may flag a subset of books for pretranslation by including their [abbreviations](https://github.com/sillsdev/libpalaso/blob/master/SIL.Scripture/Canon.cs) ///
in the textIds parameter. If the engine does not support pretranslation, these fields have no effect. ///
- ///
The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON string. - ///
A typical use case would be to set `"options"` to `"{\"max_steps\":10}"` in order to configure the maximum + ///
The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object. + ///
A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum ///
number of training iterations in order to reduce turnaround time for testing purposes. /// /// The translation engine id @@ -2918,8 +2918,8 @@ public string BaseUrl ///
you may flag a subset of books for pretranslation by including their [abbreviations](https://github.com/sillsdev/libpalaso/blob/master/SIL.Scripture/Canon.cs) ///
in the textIds parameter. If the engine does not support pretranslation, these fields have no effect. ///
- ///
The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON string. - ///
A typical use case would be to set `"options"` to `"{\"max_steps\":10}"` in order to configure the maximum + ///
The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object. + ///
A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum ///
number of training iterations in order to reduce turnaround time for testing purposes. /// /// The translation engine id @@ -4457,7 +4457,7 @@ public partial class TranslationBuild public System.DateTimeOffset? DateFinished { get; set; } = default!; [Newtonsoft.Json.JsonProperty("options", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string? Options { get; set; } = default!; + public object? Options { get; set; } = default!; } @@ -4504,7 +4504,7 @@ public partial class TranslationBuildConfig public System.Collections.Generic.IList? Pretranslate { get; set; } = default!; [Newtonsoft.Json.JsonProperty("options", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string? Options { get; set; } = default!; + public object? Options { get; set; } = default!; } diff --git a/src/Serval.Translation/Contracts/TranslationBuildConfigDto.cs b/src/Serval.Translation/Contracts/TranslationBuildConfigDto.cs index 14e1d2c4..51297a9e 100644 --- a/src/Serval.Translation/Contracts/TranslationBuildConfigDto.cs +++ b/src/Serval.Translation/Contracts/TranslationBuildConfigDto.cs @@ -5,5 +5,10 @@ public class TranslationBuildConfigDto public string? Name { get; set; } public IList? Pretranslate { get; set; } - public string? Options { get; set; } + /// + /// { + /// "property" : "value" + /// } + /// + public object? Options { get; set; } } diff --git a/src/Serval.Translation/Contracts/TranslationBuildDto.cs b/src/Serval.Translation/Contracts/TranslationBuildDto.cs index 65fa4558..9d9fa190 100644 --- a/src/Serval.Translation/Contracts/TranslationBuildDto.cs +++ b/src/Serval.Translation/Contracts/TranslationBuildDto.cs @@ -19,5 +19,11 @@ public class TranslationBuildDto /// public JobState State { get; set; } public DateTime? DateFinished { get; set; } - public string? Options { get; set; } + + /// + /// { + /// "property" : "value" + /// } + /// + public object? Options { get; set; } } diff --git a/src/Serval.Translation/Controllers/TranslationEnginesController.cs b/src/Serval.Translation/Controllers/TranslationEnginesController.cs index e23e8128..7a363cca 100644 --- a/src/Serval.Translation/Controllers/TranslationEnginesController.cs +++ b/src/Serval.Translation/Controllers/TranslationEnginesController.cs @@ -772,8 +772,8 @@ CancellationToken cancellationToken /// you may flag a subset of books for pretranslation by including their [abbreviations](https://github.com/sillsdev/libpalaso/blob/master/SIL.Scripture/Canon.cs) /// in the textIds parameter. If the engine does not support pretranslation, these fields have no effect. /// - /// The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON string. - /// A typical use case would be to set `"options"` to `"{\"max_steps\":10}"` in order to configure the maximum + /// The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object. + /// A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum /// number of training iterations in order to reduce turnaround time for testing purposes. /// /// The translation engine id @@ -1020,7 +1020,7 @@ private static Build Map(Engine engine, TranslationBuildConfigDto source) var jsonSerializerOptions = new JsonSerializerOptions(); jsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter()); build.Options = JsonSerializer.Deserialize>( - source.Options ?? "{}", + source.Options?.ToString() ?? "{}", jsonSerializerOptions ); } @@ -1070,7 +1070,7 @@ private TranslationBuildDto Map(Build source) QueueDepth = source.QueueDepth, State = source.State, DateFinished = source.DateFinished, - Options = JsonSerializer.Serialize(source.Options) + Options = source.Options }; }