Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerType set to Array instead of List #214

JDiPierro opened this issue Jul 2, 2014 · 2 comments


Copy link

commented Jul 2, 2014

Hey All,

I've got Swagger 1.3.6 integrated into a Dropwizard application and I'm trying to generate a Java client for my service. One of my endpoints returns a List. I've got it properly annotated as such:

        value = "List all Contacts",
        response = ContactData,
        responseContainer = "List"

I've run swagger-codegen on this but when I access listContacts on the generated jar I get the following error:

 Can not deserialize instance of client.model.ContactData out of START_ARRAY token

In the generated code I can see that the responseContainer is being populated as "Array":

return (List<ContactData>) ApiInvoker.deserialize(response, "Array", ContactData.class);

However in the deserialize method it's looking for "List":

if("List".equals(containerType)) {

I threw a breakpoint in my code that's using the client and manually changed "Array" to "List" and it worked.

This issue may be in the wrong place though. I'm wondering if this is an issue with swagger-core itself.. With the annotation I posted above showing responseContainer = "List" I'm getting the following output in http://localhost/api-docs/contacts:

    path: "/contacts",
    operations: [
        method: "GET",
        summary: "List all Contacts",
        notes: "",
        type: "array",
        items: {
            $ref: "ContactData"
        nickname: "listContacts",

It's listing the type as "array".

Please let me know if I'm doing something stupid that's causing this issue, or if I can provide any more information to help understand it.



This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2014

Just realized that this related to #164


This comment has been minimized.

Copy link

commented Jul 8, 2014

Sounds like same issue as #189 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.