Stefan Tsalapatis - 196 - Dec 15, 2014

Using Swagger,  in case that  the service’s response  is    a List<T>, it displays as response class  the single T object.  Only if I encapsulate  the  List in a response class, it displays the correct schema .
e.g FindCustomersResponce {  customers (Array[epsCustomer]), }
It is a problem, I can’t use a List<T>  as the  users will not have correct schema.

Mike Mertsock:

What happens if you document your response as a subclass of List<T>? e.g. class FindCustomersResponse : List<epsCustomer> { }

Stefan Tsalapatis:

In the case of a subclass of List<T>,
then swagger displays
TestCustomersResponse {
capacity (int),
count (int),
item (epsCustomer)
}
It does not seem good. We try to avoid inheritance. Also
 if I have to create a response object, I prefer to define theList as a member property.

Can you open up a new issue at: https://github.com/ServiceStack/Issues
with a screenshot of the issue and DTO’s you’re using as I’m not sure what you mean, I’ve added a new service that returns and array (and List<T>) and the model schema does look like it’s returning a JSON array:

http://test.servicestack.net/swagger-ui/#!/metadatatest-array/getmetadatatestarray

Stefan Tsalapatis:

The metadatatestarray  returns a  response object in which there is a  member property  List or array. 
MetadataTestChild {
Name (string),
Results (Array[MetadataTestNestedChild])
}
this works fine.
 But if we  only return as response  a List<T>  , then it displays only the T object.   I have not time now to create an issue, I will try tomorrow

Stefan Tsalapatis:

I added  a new Issue with a Gist

Just figured out what you meant - this is intended behavior for collection responses as seen in the Swagger UI example for a collection response:  http://petstore.swagger.wordnik.com/#!/pet/findPetsByTags