swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.34k stars 8.92k forks source link

Suggestion: UI > Model #3898

Open hlubovac opened 6 years ago

hlubovac commented 6 years ago

Hi -

Thanks for great UI.

Small suggestion: I don't think a user of the UI is interested in names of swagger-models, so I think those are just a distraction and clutter. I'm referring to these (example: "request:lab:create:data"):

image

Maybe do show them in the "Models" section that appears on the bottom (where all models are listed), but maybe not "inline" (within request and response info). If those "collapsing" arrows are instead displayed next to the name of attribute, everything would continue to work just fine. Alternatively, maybe do continue display the model name, but in less distracting fashion (tooltips over attributes names, tiny font, or similar). I see tooltips are present anyway (although, kind of, redundantly).

I'm following jsonapi.org specs to structure my inputs and outputs, and those have a lot more "depth" and "flavors" (across various methods) compared to the Petstore sample, so unimportant information being out of the way helps understanding that structure better, I think.

Not criticizing; just a suggestion :)

Thank you for the great code. I like this UI much better than v2!

Thanks. Hari

shockey commented 6 years ago

I don't think a user of the UI is interested in names of swagger-models

You're right, there's two different user stories in play here: maintainer and consumer.

As a maintainer, it's helpful to see the nested model names so I can cross-reference things and edit my definition (we have to think about the Swagger-Editor usage here as well)... but as a user, I don't really care, I just want to know what the structure looks like.

Maybe do show them in the "Models" section that appears on the bottom (where all models are listed), but maybe not "inline" (within request and response info)

This seems like a fair compromise. We could also add a "show nested names" switch, which wouldn't be a difficult addition.

Your other options seem tenable as well.


cc: @Minasokoni + @webron

heldersepu commented 6 years ago

I don't think this is an issue there are plenty of configuration for that

https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#display And worst case users can hide what they want with CSS