How to force v1.0 rather than render and accept v1 #1141
-
| I borrowed a project from the sample for my own project and its working fine, I'm grateful for the sample projects, they are a great help. But something I noticed (and the sample behaves the same way) is that swagger generates a UI that shows  I want to enforce the full version number though, I want Swagger to not render      So what would need to change in this project to get that behavior? where a  https://github.com/dotnet/aspnet-api-versioning/tree/main/examples/AspNetCore/WebApi/OpenApiExample | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
| This is covered by the Custom API Version Format Strings topic. From the example, you have set  The minor version is optionally when  options.GroupNameFormat = "'v'VV";The  | 
Beta Was this translation helpful? Give feedback.



You can't cause
1to be rejected, but1.0to be accepted out of the box. It might be possible through some configuration, but - honestly - it will probably be more trouble than it's worth. You can, however, have the URLs usev1.0overv1. This is almost the same configuration as before a la:Note that this format configuration does not use include the
'v'literal in the format. That's because you would have already included it in your route template; for example,[Route("api/v{version:apiVersion}/[controller]")]. This setting configures how the API version is formatted when it is substituted in the template, which is already enabl…