[REQ] detect circular refs in models / detect if container contains models
Created by: AIexG
Is your feature request related to a problem? Please describe.
If a schemas has a property with a ref, which references the current schema in a circle (or loop/cycle), generators in some languages (e.g. C++) might have problems with finding the classes referenced.
Example: Store -> Pet -> Person -> Store Store references Pet directly and Person indirectly as Person references Store again. Pet references Person directly and Store indirectly as Store references Pet again. Person references Store directly and Pet indirectly as Pet references Person again.
Arrays of primitives usually need to be handled differently than arrays of objects, a flag which indicates the latter could come in handy.
Describe the solution you'd like
Add a member to CodegenModel which stores all circular referenced schemas.
Add a member flag to CodegenProperty which is true if an array schema consists of object schema items.
Additional context
I'm currently trying to improve the cpp-restbed codegen and found the need to forward declare classes in the template.
While trying to make the server work "out-of-the-box" I've encountered the problem that there seems no possibility in the template to differentiate containers of primitives or containers of objects.
Already creating a PR for this.