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