Closed rajeswarikolluri closed 3 years ago
model_3.0.19.zip model_3.0.16.zip
openapi: "3.0.0" info: description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key
special-key` to test the authorization filters."
version: "1.0.0"
title: "Swagger Petstore"
tags:
Pet
schema with Dog
-specific properties Dog
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
Cat: # "Cat" is a value for the pet_type property (the discriminator value)
allOf: # Combines the main Pet
schema with Cat
-specific properties
Cat
properties: hunts: type: boolean age: type: integer`
Model of PET with Swagger Generator 3.0.16
@Validated @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-04-23T11:28:27.017+05:30[Asia/Calcutta]") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true ) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "Cat"), @JsonSubTypes.Type(value = Dog.class, name = "Dog"), }) public class Pet {
Model of PET with Swagger Generator 3.0.19
@Validated @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-04-23T11:32:12.263+05:30[Asia/Calcutta]") public class Pet {
The same issue happens with me. Until version 3.0.18 the @JsonTypeInfo was put into the class, after this version, not is putting.
@Validated @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-07-02T15:12:56.488-03:00[America/Sao_Paulo]") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "tipoPessoa", visible = true ) @JsonSubTypes({ @JsonSubTypes.Type(value = PessoaJuridica.class, name = "PessoaJuridica"), @JsonSubTypes.Type(value = PessoaFisica.class, name = "PessoaFisica"), }) public class Pessoa { ...
===============================================================================
@Validated @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-07-02T15:00:31.725-03:00[America/Sao_Paulo]") public class Pessoa { /**
openapi: 3.0.0 servers:
The same happened to me. It works in version 3.0.18, but fails in versions 3.0.19 and 3.0.20.
Similar issue raised - https://github.com/swagger-api/swagger-codegen-generators/issues/686
Hi all,
For me no codegen cli v3 version are generating the jackson @JsonTypeInfo
I have tested version : 17 -> 21
Using this command line :
java -Dmodels -jar swagger-codegen-cli-3.0.18.jar generate -l java -i rest-api-v3-light.yaml -o generated
or
java -Dmodels -jar swagger-codegen-cli-3.0.18.jar generate -l spring -i rest-api-v3-light.yaml -o generated
Any idea ?
`openapi: 3.0.2 info: version: 1.0.0 title: Sample API components: schemas:
FloatKeyframeParameter:
type: object
required:
- offset
- value
properties:
offest:
type: string
format: int64
value:
type: number
format: float
Shape:
type: object
properties:
shape:
oneOf:
- $ref: '#/components/schemas/RectangleShape'
- $ref: '#/components/schemas/CircularShape'
discriminator:
propertyName: objectType
RectangleShape:
type: object
required:
- objectType
- offset
- value
properties:
objectType:
type: string
default: RectangleShape
x:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
y:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
w:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
h:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
CircularShape:
type: object
required:
- objectType
- offset
- value
properties:
objectType:
type: string
default: CircularShape
x:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
y:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
r:
type: array
items:
$ref: '#/components/schemas/FloatKeyframeParameter'
`
Description
Issue noticed in generated models for inherited classes while using Swagger Code Generator version 3.0.19.
Swagger-codegen version
3.0.19
Swagger declaration file content or url
openapi: "3.0.0" info: description: "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key
special-key
to test the authorization filters." version: "1.0.0" title: "Swagger Petstore" tags:Pet
schema withDog
-specific propertiesall other properties specific to a
Dog
properties: bark: type: boolean breed: type: string enum: [Dingo, Husky, Retriever, Shepherd] Cat: # "Cat" is a value for the pet_type property (the discriminator value) allOf: # Combines the main
Pet
schema withCat
-specific propertiesall other properties specific to a
Cat
properties: hunts: type: boolean age: type: integer
Suggest a fix/enhancement
Same works with Swagger Generator 3.0.16