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
  • #4189
Closed
Open
Issue created Oct 20, 2019 by Jim Schubert@jimschubertContributor

[REQ] Log a warning for use of allOf without discriminator

Is your feature request related to a problem? Please describe.

No, common usage errors.

Describe the solution you'd like

Evaluate models after parsing, and if any are allOf, but the target schema doesn't have a discriminator field, trigger this as a warning.

We currently only display warnings if there are already errors in the spec (see https://github.com/OpenAPITools/openapi-generator/blob/f43c720b08496e1144ce64317bc060277e4acec2/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java#L458).

I think warnings should be moved out of the error condition and display those plus the one suggestion in this PR regardless of errors.

We'd need to define whether or not setting the strict spec flag to false would hide this warning.

Describe alternatives you've considered

n/a

Additional context

I was emailed directly by a user whose team upgraded from OpenAPI 2.0 to OpenAPI 3.0 documentation. His team didn't understand why base classes would generate in the 3.x branch but not in the 4.x branch. I explained to him that it was common for people to miss that the spec requires a discriminator property, because it's not a very intuitive requirement. Ideally, our tooling should provide this information to all users.

Assignee
Assign to
Time tracking