-
Notifications
You must be signed in to change notification settings - Fork 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
recursive model definitions causes crash #728
Comments
Are you suggesting it should throw an exception with a proper error message instead ? |
I'm suggesting it could generate valid code instead. It is not impossible, in my manually implemented client library I have some code like this. |
For the client library you mentioned, may I know what programming language did you use ? I'm not sure if all programming languages support circular references. |
C# and Java. Both have no problems with something like this public class Pet {
private Pet pet;
} |
For the models with circular reference, does it work in swagger-ui? Just want to know if other swagger tools already support models with circular reference. |
Yes, and the swagger-editor added support for it a couple months ago. |
I thought this was fixed, but I believe it's simple to do in XmlExampleGenerator.java |
Fixed #728: Handling of recursive model definitions has been improved.
Fixed in develop_2.0. |
The better solution is that the UIs and processors need to handle this properly instead of endlessly looping. |
@JohnGalt1717 are you referring to swagger-ui? |
Yes, among others. The problem is there code that doesn't cache entries and just link it back up again instead of just following the path blindly. (And their latest code as the same issue) |
Ok. Please open the issue in https://github.com/swagger-api/swagger-ui instead. |
Already done. But I was just making a point that this isn't really an issue here, it's a UI and parsing issue on the other side. |
If you have a model with a self reference, the code generator crashes:
The text was updated successfully, but these errors were encountered: