Please file a ticket directly on the project.

 

 

From: 'Philipp' via Swagger <[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, October 9, 2017 at 01:07
To: Swagger <[email protected]>
Subject: Error in generated code (Java JAX-RS, serverside) for extended models

 

There is a big bug in code generation for Java JAX-RS (serverside) when 
extended models are used. For example I have a Sawgger definition like this:

...
MyModel:
    type: object
    discriminator: type
    properties:
      type:
        type: string
        enum:
          - MyExtendedModel1
          - MyExtendedModel2
      status:
        type: string
      id:
        type: integer
        
MyExtendedModel1:
    type: object
    allOf:
      - $ref: '#/definitions/MyModel'
    properties:
      name:
        type: string

MyExtendedModel2:
    type: object
    allOf:
      - $ref: '#/definitions/MyModel'
    properties:
      address:
        type: string
...



The generation generates 3 classes: MyModel, MyExtendedModel1 extends MyModel, 
MyExtendedModel2 extends MyModel. That is correct. The class MyModel has all 
attributes how they are defined in Swagger.
The Error is in extended classes MyExtendedModel1 and MyExtendedModel2. They 
have no attributes (name for class MyExtendedModel1 is missing and address for 
class MyExtendedModel2), neither the equals(), hashCode() or toString() method 
refers to the super class MyModel.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to