Skip to content
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

[swift3] fix infinite loop with inheritance and check if parent decoder exists #5416

Merged
merged 1 commit into from
Apr 20, 2017
Merged

[swift3] fix infinite loop with inheritance and check if parent decoder exists #5416

merged 1 commit into from
Apr 20, 2017

Conversation

julienfouilhe
Copy link
Contributor

@julienfouilhe julienfouilhe commented Apr 18, 2017

PR checklist

  • Read the contribution guidelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

My last commit (b1a39ac) had introduced an infinite loop if you were using discriminator and returning a class that has a parent in one of your routes. By ensuring the instance is nil before "going down" in the tree, we ensure that we're not already "going up", thus removing the infinite loop.

Steps to reproduce

In the petstore, add a route /cats returning Cat elements only. It will first go through the Cat decoder, that will call the Animal decoder, which has a discriminator on className and thus will call the Cat decoder again...

@julienfouilhe
Copy link
Contributor Author

@wing328 wing328 added this to the v2.2.3 milestone Apr 20, 2017
@wing328 wing328 merged commit edb80df into swagger-api:master Apr 20, 2017
@wing328 wing328 changed the title fix(swift3): fix infinite loop with inheritance and check if parent decoder exists [swift3] fix infinite loop with inheritance and check if parent decoder exists Apr 22, 2017
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants