swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[java] Enum conversion in Java (for Jersey as well as retrofit) is not happening appropriately

Open sbelan opened this issue 10 years ago • 3 comments

@wing328 Enum conversion in Java (for Jersey as well as retrofit) is not happening appropriately. For e.g I have following structure: Car: Type: string Enum: [“ford”, “chevy”, “lexus”] MyProfile: Properties: MyCar: Type: “#/definitions/Car”

Then, for jersey, car.java gets generated correctly with Car object as enum, but MyCar object gets messed up, as it gets generated as complete new class with no type information. For retrofit, this is completely broken. Car object itself gets generated as broken object without any enum tag or specified values.

sbelan avatar Feb 08 '16 12:02 sbelan

@wing328 Any more input require on this?

sbelan avatar Feb 17 '16 05:02 sbelan

MyCar:
  Type: “#/definitions/Car”

Should it be as follow instead?

MyCar:
  type: object
  schema:
    $ref: '#/definitions/Pet'

wing328 avatar Feb 17 '16 06:02 wing328

@wing328 We tried above, but it is creating MyCar as empty object with no relation to Pet.

sbelan avatar Feb 17 '16 13:02 sbelan