Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark corpus endpoints obsolete #535

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions src/Serval/src/Serval.Client/Client.g.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

public record PretranslateCorpusConfigDto
{
[Obsolete]
public string? CorpusId { get; init; }

[Obsolete]
public IReadOnlyList<string>? TextIds { get; init; }

[Obsolete]
public string? ScriptureRange { get; init; }

public string? ParallelCorpusId { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

public record PretranslateCorpusDto
{
[Obsolete]
public ResourceLinkDto? Corpus { get; init; }

[Obsolete]
public IReadOnlyList<string>? TextIds { get; init; }

[Obsolete]
public string? ScriptureRange { get; init; }

public ResourceLinkDto? ParallelCorpus { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ namespace Serval.Translation.Contracts;

public record TrainingCorpusConfigDto
{
[Obsolete]
public string? CorpusId { get; init; }

[Obsolete]
public IReadOnlyList<string>? TextIds { get; init; }

[Obsolete]
public string? ScriptureRange { get; init; }

public string? ParallelCorpusId { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ namespace Serval.Translation.Contracts;

public record TrainingCorpusDto
{
[Obsolete]
public ResourceLinkDto? Corpus { get; init; }

[Obsolete]
public IReadOnlyList<string>? TextIds { get; init; }

[Obsolete]
public string? ScriptureRange { get; init; }

public ResourceLinkDto? ParallelCorpus { get; init; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace Serval.Translation.Controllers;

#pragma warning disable CS0612 // Type or member is obsolete

[ApiVersion(1.0)]
[Route("api/v{version:apiVersion}/translation/engines")]
[OpenApiTag("Translation Engines")]
Expand Down Expand Up @@ -313,7 +315,7 @@ await _engineService.TrainSegmentPairAsync(
}

/// <summary>
/// Add a corpus to a translation engine
/// Add a corpus to a translation engine (obsolete - use parallel corpora instead)
/// </summary>
/// <remarks>
/// ## Parameters
Expand Down Expand Up @@ -344,6 +346,7 @@ await _engineService.TrainSegmentPairAsync(
/// <response code="403">The authenticated client cannot perform the operation or does not own the translation engine.</response>
/// <response code="404">The engine does not exist.</response>
/// <response code="503">A necessary service is currently unavailable. Check `/health` for more details.</response>
[Obsolete("This endpoint is obsolete. Use parallel corpora instead.")]
[Authorize(Scopes.UpdateTranslationEngines)]
[HttpPost("{id}/corpora")]
[ProducesResponseType(StatusCodes.Status201Created)]
Expand All @@ -369,7 +372,7 @@ CancellationToken cancellationToken
}

/// <summary>
/// Update a corpus with a new set of files
/// Update a corpus with a new set of files (obsolete - use parallel corpora instead)
/// </summary>
/// <remarks>
/// See posting a new corpus for details of use. Will completely replace corpus' file associations.
Expand All @@ -386,6 +389,7 @@ CancellationToken cancellationToken
/// <response code="403">The authenticated client cannot perform the operation or does not own the translation engine.</response>
/// <response code="404">The engine or corpus does not exist.</response>
/// <response code="503">A necessary service is currently unavailable. Check `/health` for more details.</response>
[Obsolete("This endpoint is obsolete. Use parallel corpora instead.")]
[Authorize(Scopes.UpdateTranslationEngines)]
[HttpPatch("{id}/corpora/{corpusId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
Expand Down Expand Up @@ -418,7 +422,7 @@ corpusConfig.TargetFiles is null
}

/// <summary>
/// Get all corpora for a translation engine
/// Get all corpora for a translation engine (obsolete - use parallel corpora instead)
/// </summary>
/// <param name="id">The translation engine id</param>
/// <param name="cancellationToken"></param>
Expand All @@ -427,6 +431,7 @@ corpusConfig.TargetFiles is null
/// <response code="403">The authenticated client cannot perform the operation or does not own the translation engine</response>
/// <response code="404">The engine does not exist</response>
/// <response code="503">A necessary service is currently unavailable. Check `/health` for more details. </response>
[Obsolete("This endpoint is obsolete. Use parallel corpora instead.")]
[Authorize(Scopes.ReadTranslationEngines)]
[HttpGet("{id}/corpora")]
[ProducesResponseType(StatusCodes.Status200OK)]
Expand All @@ -445,7 +450,7 @@ CancellationToken cancellationToken
}

/// <summary>
/// Get the configuration of a corpus for a translation engine
/// Get the configuration of a corpus for a translation engine (obsolete - use parallel corpora instead)
/// </summary>
/// <param name="id">The translation engine id</param>
/// <param name="corpusId">The corpus id</param>
Expand All @@ -455,6 +460,7 @@ CancellationToken cancellationToken
/// <response code="403">The authenticated client cannot perform the operation or does not own the translation engine.</response>
/// <response code="404">The engine or corpus does not exist.</response>
/// <response code="503">A necessary service is currently unavailable. Check `/health` for more details.</response>
[Obsolete("This endpoint is obsolete. Use parallel corpora instead.")]
[Authorize(Scopes.ReadTranslationEngines)]
[HttpGet("{id}/corpora/{corpusId}", Name = Endpoints.GetTranslationCorpus)]
[ProducesResponseType(StatusCodes.Status200OK)]
Expand Down Expand Up @@ -698,7 +704,7 @@ CancellationToken cancellationToken
}

/// <summary>
/// Get all pretranslations in a corpus of a translation engine
/// Get all pretranslations in a corpus or parallel corpus of a translation engine
/// </summary>
/// <remarks>
/// Pretranslations are arranged in a list of dictionaries with the following fields per pretranslation:
Expand All @@ -712,7 +718,7 @@ CancellationToken cancellationToken
/// Only pretranslations for the most recent successful build of the engine are returned.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="corpusId">The corpus id</param>
/// <param name="corpusId">The corpus id or parallel corpus id</param>
/// <param name="textId">The text id (optional)</param>
/// <param name="cancellationToken"></param>
/// <response code="200">The pretranslations</response>
Expand Down Expand Up @@ -761,7 +767,7 @@ CancellationToken cancellationToken
}

/// <summary>
/// Get all pretranslations for the specified text in a corpus of a translation engine
/// Get all pretranslations for the specified text in a corpus or parallel corpus of a translation engine
/// </summary>
/// <remarks>
/// Pretranslations are arranged in a list of dictionaries with the following fields per pretranslation:
Expand All @@ -774,7 +780,7 @@ CancellationToken cancellationToken
/// Only pretranslations for the most recent successful build of the engine are returned.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="corpusId">The corpus id</param>
/// <param name="corpusId">The corpus id or parallel corpus id</param>
/// <param name="textId">The text id</param>
/// <param name="cancellationToken"></param>
/// <response code="200">The pretranslations</response>
Expand Down Expand Up @@ -841,7 +847,7 @@ CancellationToken cancellationToken
/// Both scripture and non-scripture text in the USFM is parsed and grouped according to [this wiki](https://github.com/sillsdev/serval/wiki/USFM-Parsing-and-Translation).
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="corpusId">The corpus id</param>
/// <param name="corpusId">The corpus id or parallel corpus id</param>
/// <param name="textId">The text id</param>
/// <param name="textOrigin">The source[s] of the data to populate the USFM file with.</param>
/// <param name="cancellationToken"></param>
Expand Down Expand Up @@ -1753,3 +1759,5 @@ private static ModelDownloadUrlDto Map(ModelDownloadUrl source)
};
}
}

#pragma warning restore CS0612 // Type or member is obsolete
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<NoWarn>$(NoWarn);CS1591;CS1573;CS0612</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Serval/test/Serval.E2ETests/Serval.E2ETests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<NoWarn>$(NoWarn);CS1591;CS1573;CS0612</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading