Skip to content

Commit

Permalink
Fix duplicated mappedModels (OpenAPITools#7924)
Browse files Browse the repository at this point in the history
* fix duplicated mapped models

* replace discriminatorExplicitMappingVerbose with legacyDiscriminatorBehavior in comments

* use mappingName for comparison

* improve template

* fix tests

* update comments

* update ts samples
  • Loading branch information
wing328 authored Nov 20, 2020
1 parent cf8ea91 commit dd26e40
Show file tree
Hide file tree
Showing 43 changed files with 75 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.LinkedHashSet;
import java.util.TreeSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
Expand All @@ -25,22 +25,22 @@ public class CodegenDiscriminator {
private String propertyType;
private Map<String, String> mapping;

// mappedModels is populated differently if discriminatorExplicitMappingVerbose is
// mappedModels is populated differently if legacyDiscriminatorBehavior is
// True or False. When:
//
// discriminatorExplicitMappingVerbose == False, this contains:
// legacyDiscriminatorBehavior == False, this contains:
// - the name to schema map info in the discriminator mapping entry in your openapi spec OR
// - child schemas that allOf inherit self schema
//
// discriminatorExplicitMappingVerbose == True, this contains:
// legacyDiscriminatorBehavior == True, this contains:
// - the name to schema map info in the discriminMappedModelator mapping entry in your openapi spec AND
// - x-discriminator-value mappings in child oneOf + anyOf schemas + descendant schemas that allOf inherit self schema AND
// - descendant schemas that allOf inherit self schema AND
// - child oneOf + anyOf schemas
//
// see the method createDiscriminator in DefaultCodegen.java

private Set<MappedModel> mappedModels = new LinkedHashSet<>();
private Set<MappedModel> mappedModels = new TreeSet<>();

public String getPropertyName() {
return propertyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2936,7 +2936,16 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch
// for schemas that allOf inherit from this schema, add those descendants to this discriminator map
List<MappedModel> otherDescendants = getAllOfDescendants(schemaName, openAPI);
for (MappedModel otherDescendant : otherDescendants) {
if (!uniqueDescendants.contains(otherDescendant)) {
// add only if the mapping names are not the same
boolean matched = false;
for (MappedModel uniqueDescendant: uniqueDescendants) {
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())) {
matched = true;
break;
}
}

if (matched == false) {
uniqueDescendants.add(otherDescendant);
}
}
Expand All @@ -2954,6 +2963,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch
Collections.sort(uniqueDescendants);
}
discriminator.getMappedModels().addAll(uniqueDescendants);

return discriminator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
[DataContract(Name = "{{{name}}}")]
{{#discriminator}}
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
{{#children}}
[JsonSubtypes.KnownSubType(typeof({{classname}}), "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}")]
{{/children}}
{{#mappedModels}}
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{{mappingName}}}")]
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
{{/mappedModels}}
{{/discriminator}}
{{>visibility}} partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf_composition_discriminator.yaml");
DefaultCodegen codegen = new DefaultCodegen();
// codegen.discriminatorExplicitMappingVerbose remains false in the legacy use case
// codegen.legacyDiscriminatorBehavior remains false in the legacy use case
codegen.setOpenAPI(openAPI);
Schema sc;
String modelName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public void generateJsonAnnotationForPolymorphism() throws IOException {

String jsonTypeInfo = "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"className\", visible = true)";
String jsonSubType = "@JsonSubTypes({\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
" @JsonSubTypes.Type(value = BigDog.class, name = \"BigDog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
"})";
assertFileContains(Paths.get(outputPath + "/src/gen/java/org/openapitools/model/Animal.java"), jsonTypeInfo, jsonSubType);
}
Expand Down Expand Up @@ -80,8 +80,8 @@ public void doNotGenerateJsonAnnotationForPolymorphismIfJsonExclude() throws IOE

String jsonTypeInfo = "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"className\", visible = true)";
String jsonSubType = "@JsonSubTypes({\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
"})";
assertFileNotContains(Paths.get(outputPath + "/src/gen/java/org/openapitools/model/Animal.java"), jsonTypeInfo, jsonSubType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public void allOfTest() {
public void allOfTestLegacy() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf.yaml");
final RubyClientCodegen codegen = new RubyClientCodegen();
// codegen.discriminatorExplicitMappingVerbose == false by default
// codegen.setLegacyDiscriminatorBehavior(false) by default
codegen.setModuleName("OnlinePetstore");

final Schema schema = openAPI.getComponents().getSchemas().get("Person");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "Animal")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
public partial class Animal : IEquatable<Animal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "GrandparentAnimal")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
public partial class GrandparentAnimal : IEquatable<GrandparentAnimal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace Org.OpenAPITools.Model
[DataContract(Name = "ParentPet")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
public partial class ParentPet : GrandparentAnimal, IEquatable<ParentPet>, IValidatableObject
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "Animal")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
public partial class Animal : IEquatable<Animal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "GrandparentAnimal")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
public partial class GrandparentAnimal : IEquatable<GrandparentAnimal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace Org.OpenAPITools.Model
[DataContract(Name = "ParentPet")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
public partial class ParentPet : GrandparentAnimal, IEquatable<ParentPet>, IValidatableObject
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "Animal")]
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
public partial class Animal : IEquatable<Animal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract(Name = "GrandparentAnimal")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ParentPet), "ParentPet")]
public partial class GrandparentAnimal : IEquatable<GrandparentAnimal>, IValidatableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace Org.OpenAPITools.Model
[DataContract(Name = "ParentPet")]
[JsonConverter(typeof(JsonSubtypes), "PetType")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
[JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")]
public partial class ParentPet : GrandparentAnimal, IEquatable<ParentPet>, IValidatableObject
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import { exists, mapValues } from '../runtime';
import {
DogFromJSONTyped,
CatFromJSONTyped
CatFromJSONTyped,
DogFromJSONTyped
} from './';

/**
Expand Down Expand Up @@ -47,12 +47,12 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An
return json;
}
if (!ignoreDiscriminator) {
if (json['className'] === 'Dog') {
return DogFromJSONTyped(json, true);
}
if (json['className'] === 'Cat') {
return CatFromJSONTyped(json, true);
}
if (json['className'] === 'Dog') {
return DogFromJSONTyped(json, true);
}
}
return {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})
public class Animal {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})
@com.fasterxml.jackson.annotation.JsonFilter(value = "filter-name")
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = "id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
})

public class Animal {
Expand Down
Loading

0 comments on commit dd26e40

Please sign in to comment.