Swagger 2.0 + Jackson: @JsonIdentityInfo doesn't work
See original GitHub issueReferencing: http://stackoverflow.com/posts/32692609/edit
We are attempting to have Swagger 2.0. Basically, it’s great except it is ignoring the @JsonIdentityInfo and @JsonIdentityReference annotations.
public class Source {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JsonIdentityReference(alwaysAsId=true)
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "name")
@JsonProperty("sourceDefinitionName")
private SourceDefinition sourceDefinition;
... getters and setters
}
Resulting in the Swagger schema output:
{
"id": 0,
"sourceDefinitionName": {
"configuration": {},
"driver": "string",
"id": "string",
"name": "string",
"sourceType": "QUERY",
"title": "string"
}
}
You can see that it indeed reads the @JsonProperty annotation renaming the “sourceDefinition” to “sourceDefinitionName” but the value should just be a string.
Does anyone have any insight into this sort of problem with this integration?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
Swagger 2.0 + Jackson: @JsonIdentityInfo doesn't work
We are attempting to have Swagger 2.0. Basically, it's great except it is ignoring the @JsonIdentityInfo and @JsonIdentityReference ...
Read more >Swagger 2.0 + Jackson: @JsonIdentityInfo ... - Google Groups
We are attempting to have Swagger 2.0. Basically, it's great except it is ignoring the @JsonIdentityInfo and @JsonIdentityReference annotations. ... You can see ......
Read more >JsonIdentityInfo (Jackson-annotations 2.14.1 API) - javadoc.io
Annotation used for indicating that values of annotated type or property should be serializing so that instances either contain additional object identifier ...
Read more >io.swagger.jackson.ModelResolver ... - Download JAR files
JsonIdentityInfo ; import com.fasterxml.jackson.annotation. ... uses raw class, as it does not consider super class while handling schema annotation for ...
Read more >Inheritance with Jackson - Baeldung
It works in collaboration with @JsonIdentityInfo to force usage of object identities in every serialization, different from all-but-the-first-time when @ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
JsonIdentityReference still doesn’t work, using spring fox 2.6.1 version
Same issue here 😞