Issue
In all the configuration examples that I have found on here, a generic "v1" designation is used to indicate the major version number of the API.
However we publish our swagger.json files onto our api portal to provide documentation the swagger.json files are now being stored separately from the API.
It is important to display the actual version number in the documentation to ensure that swagger documentation version and the api version match up.
The OpenAPI specification v2.0 states that Info.version should provide the version of the application API.
This is easy to implement and we quite simply substitute the hard-coded "v1" with a computed semantic version number.
However we now have an issue where we have to know the API version number before we can request the swagger documentation. We would prefer to have a static URL that returns the latest version of the documentation instead.
VERSION:
v5.6.0
STEPS TO REPRODUCE:
-
Set the API version in the SwaggerConfig.cs
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{c.SingleApiVersion(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion, "My API Title),
...
-
Run the project locally
My project runs on localhost:5000
Initially my URL will be
http://localhost:50000/swagger/docs/1.0.0.0/
as I increment my versions then the swagger json will be produced on the following URLs
http://localhost:50000/swagger/docs/1.0.1.0/
http://localhost:50000/swagger/docs/1.0.2.0/
Now when I access the URL http://localhost:50000/swagger/docs/1.0.2.0/ I see this response
{
swagger: "2.0",
info: {
version: "1.0.2.0",
title: "My API Title",
EXPECTED RESULT:
I expect that I should not have to attempt to interrogate the API to discover the version number before I request the swagger JSON endpoint
ACTUAL RESULT:
My CI process is broken because of the requirement to have the API number in the URL. We need tohave a non-changing URL like http://localhost:50000/swagger/docs/latest/
Issue
In all the configuration examples that I have found on here, a generic "v1" designation is used to indicate the major version number of the API.
However we publish our swagger.json files onto our api portal to provide documentation the swagger.json files are now being stored separately from the API.
It is important to display the actual version number in the documentation to ensure that swagger documentation version and the api version match up.
The OpenAPI specification v2.0 states that Info.version should provide the version of the application API.
This is easy to implement and we quite simply substitute the hard-coded "v1" with a computed semantic version number.
However we now have an issue where we have to know the API version number before we can request the swagger documentation. We would prefer to have a static URL that returns the latest version of the documentation instead.
VERSION:
v5.6.0
STEPS TO REPRODUCE:
Set the API version in the SwaggerConfig.cs
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{c.SingleApiVersion(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion, "My API Title),
...
Run the project locally
My project runs on localhost:5000
Initially my URL will be
http://localhost:50000/swagger/docs/1.0.0.0/
as I increment my versions then the swagger json will be produced on the following URLs
http://localhost:50000/swagger/docs/1.0.1.0/
http://localhost:50000/swagger/docs/1.0.2.0/
Now when I access the URL http://localhost:50000/swagger/docs/1.0.2.0/ I see this response
{
swagger: "2.0",
info: {
version: "1.0.2.0",
title: "My API Title",
EXPECTED RESULT:
I expect that I should not have to attempt to interrogate the API to discover the version number before I request the swagger JSON endpoint
ACTUAL RESULT:
My CI process is broken because of the requirement to have the API number in the URL. We need tohave a non-changing URL like http://localhost:50000/swagger/docs/latest/