-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[BUG] 5.0.0 breaks generator if servers url relative #8266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
It should work better like that, it looks like you encountered issue #8266 OpenAPITools/openapi-generator#8266
Reverting the version of swagger-parser in 5.0.0 to 2.0.20 enabled me to have a better error message:
And true enough: adding the --skip-validate-spec to my call lets this work. Ugly, but a suitable workaroud waiting for the problem to be fixed. |
Ho it's not OpenApi so ? It's "deeper". |
It looks like there is one. In fact when I searched first, I had nto yet understood that it was coming from the url. |
Oh, my bad: the --skip-validate-spec workaround is only usable with 5.0.0 rebuilt with swagger-parser version 2.0.21 as a dependency. With the real 5.0.0, it does not work at all ! (I tested with the wrong jar). |
I should point out that there are two problems here. One is that a relative url breaks the build. The other is that the error message is incorrect. I'm having a different issue that's breaking the build (https://github.com/SwingGuy1024/OpenAPI_inputSpec_Bug) where I also get a misleading error message, so this may be a wider problem with the code. |
Might this be a windows-related problem? I had no problems generating a client from a schema with a relative path on a Linux System, a colleague however could not build it (openapi-gen 5.0.1, maven plugin) on Windows, though he could build it with an absolute path. |
Any updates on this? We definitely need that possibility to provide relative URL in servers... |
I ran into the same issue on Windows, but when I tried it on Ubuntu via WSL, it worked fine, so I assume there's something in the way paths are handled in Windows that's the problem. |
Can chip in here with the cliff notes of my experience: Is on Windows10 Validation breaks and it seems like it has tried to parse the file as en openapi2-spec:
Skipping validation made it generate the api-files, but not the component-files. If i tried building from WSL, everything worked out fine |
I think this is the underlying cause: swagger-api/swagger-parser#1553 |
What is the usual timeframe for making a new release of As currently this breaks builds for our Windows developers without involving and running the maven target for openapi-generator under WSL2 in Windows after we upgraded from 4.3.1 to 5.1.0. Thanks @jhannes for finding the underlaying cause and fixing this upstream. |
Yes, same question as norrs. Would also much appreciate a release. |
Please note that swagger-parser hasn't been released with the PR yet and I have not verified that it does in fact fix the problem in openapi-generator. So the request for a new release must start upstream :-) |
Swagger-parser 2.0.26 was just released with this fix. Upgrading the dependency in openapi-generator should allow it to work on Windows again |
This is a duplicate of #8260. |
"[BUG] openapi-generator-maven-plugin version 5.0.0 does not work for OpenApi 3.0 yml-files" OpenAPITools/openapi-generator#8260 "[BUG] 5.0.0 breaks generator if servers url relative" OpenAPITools/openapi-generator#8266
Hi recently switch from [email protected] to 5.0.0 and the generation of my swagger did not work anymore.
After hours of search, I finaly found that it was mu servers > url value that breaked the generation.
Of course my swagger is valid according to https://apitools.dev/swagger-parser/online/ (and many others).
And also specification : https://swagger.io/specification/#server-object
Step to reproduce :
Take the classic petstore : https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
Change
To
Run
Breaks with error (unclear at all)
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
I guess it breaks all generator cause it also break validate command.
The text was updated successfully, but these errors were encountered: