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

getSignature method #268

Closed
preetsan opened this issue Jul 20, 2013 · 3 comments
Closed

getSignature method #268

preetsan opened this issue Jul 20, 2013 · 3 comments

Comments

@preetsan
Copy link

Hi,
I am returning DataContainer in one my my spring mvc methods where DataContainer is a generic class which holds a list(with the name 'data') of any type.
Swagger UI generates response Model like below ..it does not give the DataContainer attribute 'data' in the Model Schema
[
{
"id":0 --- Highlight attributes
.........
}
]

Looking at the swagger js code, it seems when the return type is in above format , it just ignores the container ('data' in above case) which seems odd since the json rexponse has the 'data' element.

Thanks

@fehguy
Copy link
Contributor

fehguy commented Jul 20, 2013

Can you please share the JSON representation of the model before it appears in swagger-ui?

@preetsan
Copy link
Author

Below is the model element in the json generated by Swagger Spring mvc

{
  "Highlight": {
    "properties": {
      "id": {
        "type": "int"
      },
      "annotation": {
        "type": "string"
      },
      "resourceId": {
        "type": "string"
      },
      "appId": {
        "type": "string"
      },
      "ts": {
        "type": "long"
      },
      "userId": {
        "type": "string"
      },
      "highlight": {
        "type": "string"
      }
    },
    "type": "Highlight"
  },
  "DataContainer[Highlight]": {
    "properties": {
      "data": {
        "items": {
          "$ref": "Highlight"
        },
        "type": "List"
      }
    },
    "type": "DataContainer[Highlight]"
  }
}

@fehguy
Copy link
Contributor

fehguy commented Jul 25, 2013

OK you have generics--that means you have to manually override the model definition. Take a look here on how to do that:

https://github.com/wordnik/swagger-core/wiki/overriding-models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants