elements icon indicating copy to clipboard operation
elements copied to clipboard

Always display the Response Example panel even no explicit example block provided

Open snowbug opened this issue 3 years ago • 0 comments

Context

If a response does not define an explicit example section, there is no Response Example panel shown. I'd like to see the panel with default example values displayed, much like how the request body shows the example values in Elements, and similar to the behavior of swagger UI.

Essentially what's asked here is to always display Example Response panel, using the data type and example value of each individual field in the response schema.

Current Behavior

No "Response Example" panel displayed unless that response content defines an explicit example block.

Expected Behavior

API spec author does not need to create an example block for each response type, Elements always display the Response Example panel using the schema fields definitions.

Possible Solution(s)

Today if one clicks a schema on the left column, Elements already displays an Example panel using the individual schema field definition. We just need to have the same contents displayed when showing the API endpoints.

One reason that we prefer not to create an explicit example section is such definition is separate from the schema fields, and has the inherited risk of not matching the actual schema when the schema changes.

snowbug avatar Dec 29 '22 16:12 snowbug