You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Java (spring) server code generation of allOf field in yml seems broken #3629
Using 'allOf' no longer produces classes that extend the allof reference.
Tested in the current master branch (2.2.2), trying to generate spring-mvc server code.
When using the live swagger editor (2.3.0) things work fine however.
changed the title [-]Java (spring) server code generation of allOf field im yml s brokenseem[/-][+]Java (spring) server code generation of allOf field im yml seems broken[/+]on Aug 23, 2016
changed the title [-]Java (spring) server code generation of allOf field im yml seems broken[/-][+]Java (spring) server code generation of allOf field in yml seems broken[/+]on Aug 23, 2016
It turns out this was caused because the discriminator field was left out. Apparently this 'adds support for polymorphism' and 'The property name used MUST be defined at this schema ' in master (2.2.2) but is not needed in the live swagger editor (2.3.0)
Just a note though : the discriminator is needed to have polymorphism. If the parent model doesn't have it, then the child model will not extend it and will make a copy of its properties instead.
I came from version 2.1.6 where the discriminator was not needed in order to use polymorphism, only using 'allOf' would suffice. And after bringing our fork up to 2.2.2 it suddenly broke :)
Activity
[-]Java (spring) server code generation of allOf field im yml s brokenseem[/-][+]Java (spring) server code generation of allOf field im yml seems broken[/+][-]Java (spring) server code generation of allOf field im yml seems broken[/-][+]Java (spring) server code generation of allOf field in yml seems broken[/+]realjax commentedon Aug 23, 2016
It turns out this was caused because the discriminator field was left out. Apparently this 'adds support for polymorphism' and 'The property name used MUST be defined at this schema ' in master (2.2.2) but is not needed in the live swagger editor (2.3.0)
cbornet commentedon Aug 23, 2016
I'm working on this. Stay tuned !
cbornet commentedon Aug 23, 2016
Just a note though : the discriminator is needed to have polymorphism. If the parent model doesn't have it, then the child model will not extend it and will make a copy of its properties instead.
realjax commentedon Aug 23, 2016
Well actually it didn't make copies either.
I came from version 2.1.6 where the discriminator was not needed in order to use polymorphism, only using 'allOf' would suffice. And after bringing our fork up to 2.2.2 it suddenly broke :)
But what threw me off was that the live swagger editor ( http://editor.swagger.io/ ) doesn't require the use of the discriminator field either.
fix some inheritance/composition issues and add allOf unit tests
wing328 commentedon Oct 3, 2016
@realjax PR merged into master. Please pull the latest master to give it a try.