swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

JAX-RS incorrect reference name when using ApiModel annotation

Open sanchopancho13 opened this issue 11 years ago • 0 comments

When a response class contains a property that references a second class, an @ApiModel(value="...") annotation on the second class will cause errors in the reference path.

The sample java-jaxrs project can be modified to demonstrate the error. On the Category class add the following annotation:

@com.wordnik.swagger.annotations.ApiModel("MyCategory")

This produces the following incorrect JSON:

"definitions" : {
  "MyCategory" : { // this part is correct
    // snip
  },
  "Pet" : {
    "properties" : {
      "category" : {
        "$ref" : "#/definitions/Category" // this part is incorrect. It should be MyCategory.
      },
      // etc...

I tested this in version 1.5.1-M2.

sanchopancho13 avatar Apr 19 '15 00:04 sanchopancho13