Skip to content

Commit a38fd1b

Browse files
committed
add @JsonTypeName where appropriate
1 parent ac13f63 commit a38fd1b

9 files changed

Lines changed: 13 additions & 0 deletions

File tree

  • modules/openapi-generator/src/main/resources/JavaSpring
  • samples
    • client/petstore
      • spring-http-interface-bean-validation/src/main/java/org/openapitools/model
      • spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model
      • spring-http-interface-springboot-4/src/main/java/org/openapitools/model
      • spring-http-interface/src/main/java/org/openapitools/model
    • server/petstore
      • springboot-include-http-request-context/src/main/java/org/openapitools/model
      • springboot-x-implements-skip/src/main/java/org/openapitools/model
      • springboot/src/main/java/org/openapitools/model

modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121
{{/discriminator}}
2222
{{#jackson}}
2323
{{#isClassnameSanitized}}
24+
{{#parent}}
25+
@JsonTypeName("{{name}}")
26+
{{/parent}}
27+
{{^parent}}
2428
{{^hasDiscriminatorWithNonEmptyMapping}}
2529
@JsonTypeName("{{name}}")
2630
{{/hasDiscriminatorWithNonEmptyMapping}}
31+
{{/parent}}
2732
{{/isClassnameSanitized}}
2833
{{/jackson}}
2934
{{#withXml}}

samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3333
})
3434

35+
@JsonTypeName("Cat")
3536
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3637
public class CatDto extends AnimalDto {
3738

samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3232
})
3333

34+
@JsonTypeName("Cat")
3435
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3536
public class CatDto extends AnimalDto {
3637

samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3333
})
3434

35+
@JsonTypeName("Cat")
3536
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3637
public class CatDto extends AnimalDto {
3738

samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3232
})
3333

34+
@JsonTypeName("Cat")
3435
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3536
public class CatDto extends AnimalDto {
3637

samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3535
})
3636

37+
@JsonTypeName("Cat")
3738
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3839
public class CatDto extends AnimalDto {
3940

samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828

29+
@JsonTypeName("Cat")
2930
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3031
public class CatDto extends AnimalDto {
3132

samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/DogDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828

29+
@JsonTypeName("Dog")
2930
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3031
public class DogDto extends AnimalDto {
3132

samples/server/petstore/springboot/src/main/java/org/openapitools/model/CatDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
@JsonSubTypes.Type(value = BigCatDto.class, name = "BigCat")
3535
})
3636

37+
@JsonTypeName("Cat")
3738
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
3839
public class CatDto extends AnimalDto {
3940

0 commit comments

Comments
 (0)