-
-
Notifications
You must be signed in to change notification settings - Fork 14
[BUG][PYTHON] $ref to remote url is failing with v2.0.0 and higher #341
Comments
This is happening because it is the parsers job to get remote refs and local file refs. I turned ref resolving off to preserve refs inside openapi documents from one place to another. This could be fixed by
Is this something that you want to fix? In the meantime you can produce one openapi document with redlocity cli and use that output as the openapi document input for my tool. |
Thanks for the quick answer 🙏
I tried to understand the code to see if there was a quick fix to do. So far I am struggling to understand how this work and I do not think I have the time or capacity to deliver a fix of this amplitude |
Are you open to using redlocity cli to pre process your openapi document and bundle it into one output openapi document? |
It feels strange that this is not supported in v3 as we were using it in v1.0.4. Yes, it seems at first glance that using redocly-cli as a pre step could work for us :) |
Glad to hear that preprocessing could work for you. Turning ref resolving on resulted in overly aggressive resolution of refs where some refs to components were resolved rather than preserving the ref to the component. So I turned it off because it broke functionality and there is not enough fine grained control of the ref resolution in swagger parser. When I added support for component responses in v2.0.0 I ran in to this issue and made the change. One can see a swagger-parser bug on this issue here |
@spacether Should we close this issue as not planned ? |
Bug Report Checklist
Description
When using an http reference, the generator fails with error
[main] WARN org.openapijsonschematools.codegen.common.ModelUtils - Failed to get the schema at $ref:
Is using an http $ref supported by the generator ?
Bonus point:
Some of our http ref have local reference
./XXX.yaml
that also needs to be followed.openapi-json-schema-generator version
3.3.1
OpenAPI declaration file content or url
Generation Details
docker run --rm -v ./:/local openapijsonschematools/openapi-json-schema-generator-cli:3.3.1 generate -i /local/my-service.yml -g python -o /local/out
Steps to reproduce
Generate the client with a ref to an http yaml
Suggest a fix
The
getSimpleRef
seems to return null for any http $refopenapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/common/ModelUtils.java
Line 324 in d41a95e
And I haven't found any place where the referenced file would be downloaded.
The text was updated successfully, but these errors were encountered: