-
-
Notifications
You must be signed in to change notification settings - Fork 226
Add support for recursively defined schemas #338
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 reporting @sp-schoen! This should be fixed by #329 which all being well should make it into the 0.8 release we have coming up. |
I checked out the PR you suggested and tried it, but I still get the same error. |
Ah, looking it over again you're totally right. The stuff in there will be needed to make recursive schemas work however, so whenever that is reviewed/merged work can begin on adding support for recursive definitions. |
Just FYI @sp-schoen, @p1-ra has graciously begun working on supporting recursive definitions in the aforementioned PR! |
Was this fixed by #366 ? |
I'm not sure 😅 probably not though. #366 was just about fixing reference resolution in general, my guess is that generation will still fail for recursive models, we'll need to add a special case to those. |
Hmm, I still get errors with The repro file at the top of the issue still produces errors:
|
@emann |
Sorry, yes - I was using just that json file, but my local repro is much too large to paste in. I'll add a shorter repro if I have time! |
My bad, It was to early on the morning it looks I've messed up with my tests; probably did them on the wrong branch ....; I've redo the tests using today All sample define here are NOK |
This commit adds support for recursive and circular references in object properties and additionalProperties, but not in allOf. The changes include: -Delayed processing of schema model properties -Cascading removal of invalid schema reference dependencies -Prevention of self import in ModelProperty relative imports -Prevention of forward recursive type reference errors in generated modules -Logging for detection of recursive references in allOf
This commit adds support for recursive and circular references in object properties and additionalProperties, but not in allOf. The changes include: -Delayed processing of schema model properties -Cascading removal of invalid schema reference dependencies -Prevention of self import in ModelProperty relative imports -Prevention of forward recursive type reference errors in generated modules -Logging for detection of recursive references in allOf
#670, #338, #466]. Thanks @mtovt! Co-authored-by: maz808 <[email protected]> Co-authored-by: Dylan Anthony <[email protected]>
Describe the bug
I tried to create a python client from an OpenApi-Spec with the command
openapi-python-client generate --path secret_server_openapi3.json
. Then I got multple warnings:I searched the schemas, which are responsible for the errors and they all had in common, that they either reference another schema which is recursively defined or reference themself.
For example one of the problematic schemas:
To Reproduce
Define a schema recursively and then try to create a client from it.
Expected behavior
The software can also parse a recursively defined schema.
OpenAPI Spec File
It's 66000 Lines, so I'm not sure if this will help you, or github will allow me to post it 😄
Just ask if you need specific parts of the spec, aside from what I already provided above.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: