-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[BUG][Swift4] StackOverflow when generating example for recursive structures #2966
Closed
5 tasks done
Labels
Comments
Any updates about this problem? |
Donkov76
added a commit
to Donkov76/openapi-generator
that referenced
this issue
Aug 26, 2020
Donkov76
added a commit
to Donkov76/openapi-generator
that referenced
this issue
Aug 26, 2020
Donkov76
added a commit
to Donkov76/openapi-generator
that referenced
this issue
Aug 26, 2020
wing328
pushed a commit
that referenced
this issue
Sep 6, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report Checklist
crash vs no crash
Description
If a POST-call gets a recursive structure (e.g., a Tree) as one of its parameter, the swift4 generator crashes when trying to generate example.
openapi-generator version
master/4.0.0 introduced by #2666
OpenAPI declaration file content or url
https://gist.github.com/lemoinem/0b3d7d065d9337a898d5ee2bc49654a2
Command line used for generation
./bin/swift4-petstore.sh
while the yaml is stored atmodules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
Steps to reproduce
modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
./bin/swift4-petstore.sh
=> Crash with java.lang.StackOverflowError
Related issues/PRs
This was probably introduced by #2666 which doesn't check for recursive structure when creating an example.
Suggest a fix
At the very least, generating example/self-documentation should be optional and should fail gracefully.
At the most, the
constructExampleCode
method should check for recursive structures (circular references) and fail gracefully in this case.The text was updated successfully, but these errors were encountered: