Closed joanlofe closed 6 years ago
Thanks for reporting.
A quick work around would be taking out additionalProperties
like so
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/book"
}
}
}
But I'll make a patch that merge two object properties.
Rolled out on 0.1.145
can you check?
Hi! Thanks for the quick action and apologies for my late response. Now it shows the following:
It seems like the reponse is a book object, when in fact it should be a map with strings as keys and book instances as values, something like this:
{
"bookInstance1": {
"book_id": "integer",
"book_title": "string"
},
"bookInstance2": {
"book_id": "integer",
"book_title": "string"
},
"bookInstance3": {
"book_id": "integer",
"book_title": "string"
}
}
So, now it is better, it shows something, but the representation of the response is misleading.
By the way, tested with 0.1.148 (latest version so far)
I think I misinterpreted how additionalProperties work. Let's clear it up. Can you verify these assumption:
bookInstance1-3
is something I need to infern
would be acceptable as well.)Implementation aside, I am curious in what case are we using this over an array of object with additional key name
Anyway thanks for reporting 👍
rolled out in the 0.1.150
patch
Check it out and let me know.
Hi. I've checked it with version 0.1.151 and it is ok now. As suggestion, but it is not really needed, the key could be "book1" instead of only "book", to emphasize that there can be many books.
Regarding the use case, this is useful when you want your API to return the data in a normalized form, like the one you obtain using the Normalizr library.
Thank you very much, and congrats for the good work!
When defining a property of a type as a map, the generated html code shows nothing (empty braces) for that property. However, in swagger editor it does show correctly as expected. I am using the version from the last commit in the master branch of the repository (commit 9ceda7).
At the end I include an example swagger definition that reproduces the error.
This is how it shows in the output of pretty-swag (empty-schema):
And this how it shows in the render of swagger-editor:
The example json is also rendered ok:
Example definition that reproduces the error: