Hi Swagger Group,
We have objects nested inside of other objects in our API, sometimes up to three levels deep. Can you tell me how to document these using Swagger 2.0? I found some discussion of this in the forum, but it was dated back in 2013. It seems that a new Swagger has come out since then.
Here is some sample Swagger 2.0 JSON
"customer-object-response": {
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "The unique integer value assigned to the customer",
"required": true
},
"_authentication": {
"type": "", <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<THIS IS AN OBJECT, WHAT TO PUT HERE?
"description": "The title of the blog post"
},
So far, I have not seen any ability to render the nested objects in the swagger-ui. Here is an example of an array:
"tags": {
"type": "array",
"description": "An array containing any tags assigned to the blog post",
"items": {
"type": "string"
}
}
This is a pretty simple array, luckily, where the values are just like this: " string, string, string" So it does not present a huge issue for us, however, I noticed that the swagger-ui renders the above like this, tags (string, optional),
As you can perhaps see, the description is stripped out, in other words, it is not included in swagger-ui. When I click Model Schema, it shows up like this,
"tags": [
"string"
],
It would be maybe a bit nicer if it showed up something more like this:
"tags": [
"string, string, string, ..."
],
But as I say, this specific example is not a huge issue for us. We are more concerned about the first question, which is how to insert the descriptions of the name-value pairs of the nested objects.
Thanks so much for your help!!
Emily