Swagger UI broken imports "An API version is required, but was not specified." #1068
Replies: 6 comments 2 replies
-
Hmmm... API Versioning doesn't care about nor has any direct references to OpenAPI, Swagger UI, or Swashbuckle. My best guess, without more information, is that you have a route that maps over Another possibility is that the order of the middleware is incorrect. Assuming you are using controllers, |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This issue only appears if the API version segment is the "root segment". We were planning on having the API accessed via a subdomain |
Beta Was this translation helpful? Give feedback.
-
Strangely, if the swagger route has a multi-part prefix, then the API can have no prefix before the version:
breaks Swagger UI But: with a multi-part swagger route prefix:
works fine. |
Beta Was this translation helpful? Give feedback.
-
I expected there was always going to be some conflicts found eventually 😅
We're using:
Ha! We went back and forth over this for a while, but it seems that version in the URL is common, popular, easy to use and has great compatibility, so that's why we chose it 😁 I think that for us, we're going to switch away from the subdomain and have the API routes under Hopefully I've pointed you in the right direction for your debugging, if you get a chance to find the cause. Thanks for the excellent library! |
Beta Was this translation helpful? Give feedback.
-
The API works fine when running in Brave browser via the Visual Studio debugger. But when I try to run it on Chrome or Edge locally and also on all browser when it is deployed on IIS remotely, I get Bad Request errors on swagger's generated files:
{"type":"https://docs.api-versioning.org/problems#unspecified","title":"Unspecified API version","status":400,"detail":"An API version is required, but was not specified."}
Here is our ApiVersioning setup (we use VB):
And here is the app config:
You can see an live example of the error here:
https://openapi.3.bridgeitonline.co.uk/swagger/index.html
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions