You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order for jackson ObjectMapper to deserialize correctly a base class to its subclasses, we need to include annotations defining all expected subclasses in the parent class.
The codegen currently does not generate those annotations.
For this example YAML:
Jackson expects these annotations to be produced, but they are not:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "disc")
@JsonSubTypes({ @type(value = SubClass.class, name = "SubClass") })
public class Base {
}
Swagger-codegen version
2.2.2-SNAPSHOT
Swagger declaration file content or url
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
-i modules/swagger-codegen/src/test/resources/2_0/allOfTest.yaml
-l spring
-o /tmp/java_spring
Steps to reproduce
Run the above command.
The following annotations are not included @JsonTypeInfo @JsonSubTypes
* Issue #4606 (Spring) SubClass annotations are missing from the base class
* Issue #4606 (Spring) SubClass annotations are missing from the base class
* Commit updated samples from ./bin/spring-all-pestore.sh
davidgri
pushed a commit
to davidgri/swagger-codegen
that referenced
this issue
May 11, 2017
* Issue swagger-api#4606 (Spring) SubClass annotations are missing from the base class
* Issue swagger-api#4606 (Spring) SubClass annotations are missing from the base class
* Commit updated samples from ./bin/spring-all-pestore.sh
Description
Applying fix for #2449 to JavaSpring
Swagger-codegen version
2.2.2-SNAPSHOT
Swagger declaration file content or url
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
-i modules/swagger-codegen/src/test/resources/2_0/allOfTest.yaml
-l spring
-o /tmp/java_spring
Steps to reproduce
Run the above command.
The following annotations are not included
@JsonTypeInfo
@JsonSubTypes
Related issues
#2449
Suggest a Fix
I have submitted a pull request
The text was updated successfully, but these errors were encountered: