Use array/list in the request payload
katiaSouza opened this issue · 7 comments
Hi,
I don't know if it is possible, so I can do the same in the response payload.. my question is in relation of a request payload that has a list/array.
Example:
@RequestMapping(value = "/myuri", method = RequestMethod.POST)
public void category(Collection category)
The input in swagger should be:
[{
"categoryId": 123,
"categoryName": "My Category"
}]
But what ocurrs in swagger is:
{
"empty": "boolean"
}
Can you help me?
Collections are not supported in input parameters, mainly because given a
collection, it could be a List or a Set or anything else that implements
that interface. Either you can use the AlternateTypeRule to transform ALL
collections to a List, or you change the signature to be a List or a Set or
a Map. Generic types are supported as well.
Ok.
I tried change the signature to be a List, but occurs the same mistake.
@katiaSouza Is your list a generic list? If not try making it a generic list or adding an @apimodel annotation to indicate it is a list and specify the concrete type (Category in this case)
Thanks and sorry by response delay.
I was using other version of swagger-spring and this version not have the @apimodel annotation. I'm changing for this version, but I'm finding some problems. The first problem is dependency swagger-springmvc.0.6.0-SNAPSHOT not exist in repositories and when I try change to other version the swagger-springmvc.0.5.3, some classes that exist in the atual version not exist on this.
Can you help me?
@katiaSouza Please switch your branch to rel-0.5 and use the examples relevant to the 0.5.3 release
Thanks by your help!
@dilipkrish I switched of version and it the problem that I had with object List is resolved.
Thanks again.