rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.61k stars 271 forks source link

Content type should be indicated in consistent place for request body and response #989

Closed marshmn closed 5 months ago

marshmn commented 6 months ago

The content type (e.g. application/json) is shown in different places for the request body and response. For request body it is shown next to the title, whereas for the response it is shown top-right of the table.

I think it would be better to always place it to the top-right of the table so that's consistent for both.

I was caught out by this at least once, looking for the content type above the request body table and missing the fact it was somewhere different instead.

Screenshot from 2023-12-27 13-05-56

mrin9 commented 5 months ago

the reason it is done like that because request-body can be of many media-types and not all media-types will have a schema table

for example checkout this example where you can change request-body media type from application/json to another https://rapidocweb.com/examples/request-body-multiple.html#post-/item-price

marshmn commented 5 months ago

the reason it is done like that because request-body can be of many media-types and not all media-types will have a schema table

for example checkout this example where you can change request-body media type from application/json to another https://rapidocweb.com/examples/request-body-multiple.html#post-/item-price

I take your point - and you're right that there are definitely some complications to consider.

Looking at the example you've linked to though, isn't the same problem also true for the response? The response has two content-type options, and if text/html is selected, the schema tab looks broken - presumably for the same reason you've indicated.

It still feels like something could be done to be more consistent in where the content-type indication and/or selector is placed for both request and response?