[BUG][JAVA][SPRING] Model Inheritance over multiple layers with REF_AS_PARENT_IN_ALLOF=true
, allOf
and required parameters produces compilation error
#15148
Labels
Bug Report Checklist
Description
I have an inheritance hierarchy four levels deep:
Child
inherits fromParent
which inherits fromGrandParent
which inherits fromGreatGrandParent
.Each type has a
required
property (see full spec below).This generates the following model classes, with constructors for the required parameters. The constructor of
Child
delegates to thesuper
constructor with parameters in incorrect order, causing compiler errors if the types don't match and not causing compiler errors, if the types happen to be compatible:openapi-generator version
6.5.0 and master (ba2c42e)
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Generate code from above spec with
spring
generator andREF_AS_PARENT_IN_ALLOF=true
.Related issues/PRs
#14934
#14941
#9756
#14172
Suggest a fix
Ensure that parameters are passed into parent constructor in the correct order.
Workaround
--additional-properties=generatedConstructorWithRequiredArgs=false
can be used to skip generating the erroneous constructors.The text was updated successfully, but these errors were encountered: