Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public void Configure(SwaggerGenOptions options)
// Version information for Swagger UI
foreach (var apiVersionDescription in _provider.ApiVersionDescriptions)
{
// At the moment, API version V2 is an example and should not be visible in the API documentation.
if (apiVersionDescription.GroupName.StartsWith("v2", StringComparison.OrdinalIgnoreCase))
{
continue;
}

var openApiInfo = new OpenApiInfo
{
Title = _openApiSettings.Title,
Expand Down
6 changes: 6 additions & 0 deletions aspnetcore/src/Interface/Configuration/SwaggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public static void UseSwaggerAndSwaggerUI(this WebApplication app)
options.ConfigObject.AdditionalItems.Add("syntaxHighlight", false); // disable to improve performance with large responses
foreach (var description in app.Services.GetRequiredService<IApiVersionDescriptionProvider>().ApiVersionDescriptions)
{
// At the moment, API version V2 is an example and should not be visible in the API documentation.
if (description.GroupName.StartsWith("v2", StringComparison.OrdinalIgnoreCase))
{
continue;
}

options.SwaggerEndpoint($"{description.GroupName}/swagger.json", description.GroupName.ToUpperInvariant());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace CSC.PublicApi.Interface.Controllers.V2;

[ApiController]
[ApiExplorerSettings(IgnoreApi = true)] // At the moment, this API version is an example and should not be visible in the API documentation.
[ApiVersion(ApiVersion)]
[Route("v{version:apiVersion}/research-datasets")]
public class ResearchDatasetController : ControllerBase
Expand Down
2 changes: 2 additions & 0 deletions aspnetcore/test/Interface.Tests/SwaggerSystemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public async Task SwaggerJson_V1_ShouldLoadAndContainCorrectData()
}
}

/*
[Fact]
public async Task SwaggerJson_V2_ShouldLoadAndContainCorrectData()
{
Expand Down Expand Up @@ -144,4 +145,5 @@ public async Task SwaggerJson_V2_ShouldLoadAndContainCorrectData()
$"Swagger contains unexpected path '{actualPath}'. If this endpoint is added on purpose, please update the test to add it to the expected paths list.");
}
}
*/
}
Loading