Skip to content

[Swagger] ApiVersionNeutralAttribute clarification #998

Discussion options

You must be logged in to vote

When an API is version-neutral, it will accept any API version, including none at all. In terms of API collation, a version-neutral API will appear in a group for every API version. This posits an interesting question. Should a version-neutral document an API version? It can and it would not be wrong, but it doesn't have to. Most people have indicated that they do not want to see or document the API version as input in these cases, so that is the default behavior. This can be easily be changed however. The magic is setting the AddApiVersionParametersWhenVersionNeutral option to true. For example:

serviceCollection.AddApiVersioning(options =>
{
    options.ReportApiVersions = true;
    opt…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@westfin
Comment options

Answer selected by westfin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants