You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I just upgraded a project that was using API Platform 3.1.17 to the latest release 3.2.20 and when I try to view the Swagger docs I get the following error:
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
I can view the docs using ReDoc and download the swagger file, which I can see now has the following key; "openapi": "3.1.0" while my previous version had: "openapi": "3.0.0"
How to reproduce
Update to 3.2.20 and look at Swagger docs.
Possible Solution
I already have a decorator in my project to override the spec so it was easy for me to override the version from "3.1.0" to "3.0.0" and that makes the Swagger UI work with no further changes.
I also found the OpenApi class in ApiPlatform\OpenApi and if I change the VERSION constant to be "3.0.0" that also makes it work.
In fact, looking at my old version, that OpenApi class had the following code:
// We're actually supporting 3.1 but swagger ui has a version constraint
// public const VERSION = '3.1.0';
public const VERSION = '3.0.0';
Looks like someone removed that and set the version to "3.1.0" and now it's broken. Was there some other change that should have been done to make all this work?
It seems that the SwaggerUI really needs the version to be in the form "3.0.n" and will not accept "3.1.0"
I'm actually surprised nobody else has reported this. Is it just me? Am I missing something?
Additional Context
The text was updated successfully, but these errors were encountered:
API Platform version(s) affected: 3.2.20
Description
I just upgraded a project that was using API Platform 3.1.17 to the latest release 3.2.20 and when I try to view the Swagger docs I get the following error:
I can view the docs using ReDoc and download the swagger file, which I can see now has the following key;
"openapi": "3.1.0"
while my previous version had:"openapi": "3.0.0"
How to reproduce
Update to 3.2.20 and look at Swagger docs.
Possible Solution
I already have a decorator in my project to override the spec so it was easy for me to override the version from "3.1.0" to "3.0.0" and that makes the Swagger UI work with no further changes.
I also found the OpenApi class in ApiPlatform\OpenApi and if I change the VERSION constant to be "3.0.0" that also makes it work.
In fact, looking at my old version, that OpenApi class had the following code:
Looks like someone removed that and set the version to "3.1.0" and now it's broken. Was there some other change that should have been done to make all this work?
It seems that the SwaggerUI really needs the version to be in the form "3.0.n" and will not accept "3.1.0"
I'm actually surprised nobody else has reported this. Is it just me? Am I missing something?
Additional Context
The text was updated successfully, but these errors were encountered: