This issue comes up for every method that returns a List of a model.
For instance, we have this getOrgs method and corresponding generated model:
@GET
@Path("/orgs")
@ApiOperation(value = "Lists all Orgs.")
@ApiResponses(value = {@ApiResponse(code = 500, message = Constants.
BASE_PATH_NOT_FOUND) })
public List<Org> getOrgs() throws ServiceException;
Inline Model [
Inline Model 1
]
Inline Model 1 {
id (string, optional),
batches (Array[Batch], optional)
}
Batch {
id (integer, optional),
}
Instead of Inline Model 1, we expect it to say Org, as annotated by the
response property. The swagger.json correctly states that the response is a
collection of Orgs:
"summary":"Lists all Orgs.","description":"","operationId":"getOrgs",
"parameters":[],"responses":{"200":{"description":"successful operation",
"schema":{"type":"array","items":{"$ref":"#/definitions/Org"}}}
Before grabbing last week's dist folder and upgrading to swagger-core and
swagger-jaxrs 1.5.9, we were on version 1.3 and the response model for
getOrgs didn't display any Inline Models for the same annotations:
Org {
id (string, optional),
batches (array[Batch], optional)
}
Batch {
id (integer, optional)
}
All methods returning a single Org are displayed properly with no inline
models. The Org model class has no annotations on it, though I have also
tried an @ApiModelProperty annotation on the Org model, as well as
specifying response = Org.class and responseContainer = "List" in
ApiOperation.
It appears as if this isn't a Swagger issue as the Petstore sample
correctly displays the Pet model in the /findByStatus method, but I can't
figure out how our declarations differ.
Thanks for the help.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.