Skip to content

Java (spring) server code generation of allOf field in yml seems broken #3629

Closed

Description

@realjax

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.

Activity

  1. 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
  2. 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
  3. realjax commented on Aug 23, 2016

    @realjax
    Author

    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)

  4. cbornet commented on Aug 23, 2016

    @cbornet
    Contributor

    I'm working on this. Stay tuned !

  5. cbornet commented on Aug 23, 2016

    @cbornet
    Contributor

    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.

  6. realjax commented on Aug 23, 2016

    @realjax
    Author

    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.

  7. added a commit that references this issue on Aug 24, 2016
    194c389
  8. added this to the v2.2.2 milestone on Oct 3, 2016
  9. wing328 commented on Oct 3, 2016

    @wing328
    Contributor

    @realjax PR merged into master. Please pull the latest master to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions