Swagger 2.0 + Jackson: @JsonIdentityInfo doesn't work

163 views
Skip to first unread message

Thomas Beauvais

unread,
Sep 21, 2015, 6:35:18 AM9/21/15
to Swagger
Referencing:  http://stackoverflow.com/questions/32692609/swagger-2-0-jackson-jsonidentityinfo-doesnt-work

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?

Ron Ratovsky

unread,
Sep 21, 2015, 7:04:40 AM9/21/15
to Swagger
I'd suggest opening an issue on swagger-core.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Thomas Beauvais

unread,
Sep 21, 2015, 7:35:37 AM9/21/15
to swagger-sw...@googlegroups.com
Thanks Ron, where might I do that?  On GitHub?  Do you have a specific link?  Cheers!

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/89qOf0XZJbM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

Ron Ratovsky

unread,
Sep 21, 2015, 7:36:37 AM9/21/15
to Swagger
Reply all
Reply to author
Forward
0 new messages