Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4757
Closed
Open
Issue created Dec 10, 2019 by Administrator@rootContributor

[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.

Assignee
Assign to
Time tracking