Render models in UI code, not JS
This may be a duplicate, but we need to move the rendering of models out of swagger-js and into swagger-ui.
- [ ] add rendering of read-only attributes
- [ ] update rendering in responses to show complete schemas for each response code. See https://github.com/swagger-api/swagger-ui/issues/671, https://github.com/swagger-api/swagger-ui/issues/640, https://github.com/swagger-api/swagger-ui/issues/1248, https://github.com/swagger-api/swagger-ui/issues/1055
- [ ] add formats in rendering, https://github.com/swagger-api/swagger-ui/issues/1202
- [ ] render examples in UI, not JS, https://github.com/swagger-api/swagger-ui/issues/1213
- [x] XML examples #583, #744
- [ ] Add map rendering #558
- [ ] Consider different JSON renderer, #863
Shouldn't there be an equivalent issue in swagger-js for removing it?
Sorry but being new here, could someone tell how can I find out which release version has or will have this issue fixed?
@makimat - we haven't set a plan for it yet.
:+1: It appears the issue I mentioned over at https://github.com/swagger-api/swagger-spec/issues/303 is caused by this Basically when I try to use a mimetype for the produces like multipart/mixed, I can't get the example to show unless I use object, and then it shows in an undesirable way. String is the type that would work as a workaround, but it doesn't show.
Also a big :+1: to getting readOnly to have meaning in the UI.
+1 for showing model descriptions in the UI
+1
We would also really love to have support for the readOnly property!
+1 for this feature!
+1
:+1:
+1
Hi, is there an update to when we will be able to document Maps for JSON responses? I'm trying to push Swagger in our organization and this is one of the things I have trouble explaining to the masses that we cannot show JSON schemas with maps.
Simple maps are easy but complex maps (values which are complex models) are tricky. The most helpful input would be how you'd expect them to appear in both the sample and schema views
@fehguy fair enough! I'll be in the office soon and will push some examples over to you. Stay tuned and thanks for your response.
Here's what I propose @fehguy:
Here is the sample JSON. This a simple response of a map of product objects with the key being the product number.
{
"products": {
"01234": {
"shortDescription": "Sample Product Description",
"price": 100.00
},
"56789": {
"shortDescription": "Another Sample Product Description",
"price": 50.00
}
}
}
Here is how I propose (roughly!) it should look in the model schema view:

Here is how I propose (in YAML using Swagger editor) we define a map:
Response:
description: "Sample description"
type: object
properties:
products:
type: map
key:
description: "Product identifier"
type: string
value:
$ref: "#/definitions/Product"
Product:
description: Product Object
type: object
properties:
shortDescription:
description: Sample description.
type: string
price:
description: Price of product.
type: number
I hope this helps @fehguy. I had a few developers at my desk to put this proposal together for maps as many of us in the organization are taking advantage of maps within our response models and we're all big fans of Swagger. As I said before this is one of the main missing pieces to complete our documentation. There are others questioning the use of Swagger due to this limitation and I'm trying to evangelize it. I hope the example above helps provide a general guideline what we're looking for and I know other users of the Swagger community have been asking for this. Thanks very much for your attention to this and hope there's something cool that comes out of this!
thanks @cabbonizio this is a pretty easy fix in the short term. There are some limitations, though, that make it harder to support, such as in-line map definitions, etc.
@fehguy, thanks for the response I'm excited to hear this would be an easy fix. Just curious, is this a "fix" or actually an "enhancement" since maps are currently not supported? Either way, I'm hoping maps will be available soon.
I agree, complex map definitions and in-line definitions would be challenging, but like anything else those can be incremental and if you show people Swagger can support maps, even if functionality is limited at the start, this is a step in the right direction.
Curious, how soon would I be able to test something out for map support?