diff --git a/src/Serval/src/Serval.Client/Client.g.cs b/src/Serval/src/Serval.Client/Client.g.cs index 9f382ca3..6766766a 100644 --- a/src/Serval/src/Serval.Client/Client.g.cs +++ b/src/Serval/src/Serval.Client/Client.g.cs @@ -4337,11 +4337,11 @@ public partial interface ITranslationEnginesClient /// Will completely replace corpus' file associations. Will not affect jobs already queued or running. Will not affect existing pretranslations until new build is complete. /// /// The translation engine id - /// The corpus configuration /// The corpus id + /// The corpus configuration /// The corpus was updated successfully /// A server side error occurred. - System.Threading.Tasks.Task UpdateParallelCorpusAsync(string id, TranslationParallelCorpusUpdateConfig corpusConfig, string corpusId, string? parallelCorpusId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task UpdateParallelCorpusAsync(string id, string parallelCorpusId, TranslationParallelCorpusUpdateConfig corpusConfig, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// @@ -6376,17 +6376,17 @@ public string BaseUrl /// Will completely replace corpus' file associations. Will not affect jobs already queued or running. Will not affect existing pretranslations until new build is complete. /// /// The translation engine id - /// The corpus configuration /// The corpus id + /// The corpus configuration /// The corpus was updated successfully /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UpdateParallelCorpusAsync(string id, TranslationParallelCorpusUpdateConfig corpusConfig, string corpusId, string? parallelCorpusId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task UpdateParallelCorpusAsync(string id, string parallelCorpusId, TranslationParallelCorpusUpdateConfig corpusConfig, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) throw new System.ArgumentNullException("id"); - if (corpusId == null) - throw new System.ArgumentNullException("corpusId"); + if (parallelCorpusId == null) + throw new System.ArgumentNullException("parallelCorpusId"); if (corpusConfig == null) throw new System.ArgumentNullException("corpusConfig"); @@ -6406,17 +6406,11 @@ public string BaseUrl var urlBuilder_ = new System.Text.StringBuilder(); if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "translation/engines/{id}/parallel-corpora/{corpusId}" + // Operation Path: "translation/engines/{id}/parallel-corpora/{parallelCorpusId}" urlBuilder_.Append("translation/engines/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/parallel-corpora/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(corpusId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (parallelCorpusId != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("parallelCorpusId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(parallelCorpusId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(parallelCorpusId, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); diff --git a/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs b/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs index 916e396a..3b2143bc 100644 --- a/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs +++ b/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs @@ -583,7 +583,7 @@ CancellationToken cancellationToken /// The engine or corpus does not exist. /// A necessary service is currently unavailable. Check `/health` for more details. [Authorize(Scopes.UpdateTranslationEngines)] - [HttpPatch("{id}/parallel-corpora/{corpusId}")] + [HttpPatch("{id}/parallel-corpora/{parallelCorpusId}")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(void), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] diff --git a/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs b/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs index d79d1e86..9c6cd528 100644 --- a/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs +++ b/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs @@ -645,8 +645,8 @@ string engineId Assert.That(engine, Is.Not.Null); Assert.Multiple(() => { - Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE2_FILENAME)); - Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE1_FILENAME)); + Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE1_FILENAME)); + Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE2_FILENAME)); }); break; } @@ -891,7 +891,7 @@ string engineId SourceCorpusIds = [SOURCE_CORPUS_ID], TargetCorpusIds = [TARGET_CORPUS_ID] }; - await client.UpdateParallelCorpusAsync(engineId, updateConfig, result.Id); + await client.UpdateParallelCorpusAsync(engineId, result.Id, updateConfig); Engine? engine = await _env.Engines.GetAsync(engineId); Assert.That(engine, Is.Not.Null); Assert.Multiple(() => @@ -917,7 +917,7 @@ string engineId SourceCorpusIds = [SOURCE_CORPUS_ID], TargetCorpusIds = [TARGET_CORPUS_ID] }; - await client.UpdateParallelCorpusAsync(engineId, updateConfig, DOES_NOT_EXIST_CORPUS_ID); + await client.UpdateParallelCorpusAsync(engineId, DOES_NOT_EXIST_CORPUS_ID, updateConfig); }); Assert.That(ex?.StatusCode, Is.EqualTo(expectedStatusCode)); break;