Forum Discussion

KayS's avatar
KayS
Occasional Visitor
2 years ago

Formatting of object examples

Hi,

 

When I provide examples of simple types, like strings, in my Open API spec, the output formatting is fine, but when I provide examples of list types or objects, the example is displayed in plain text with no return characters or indenting:

Excerpt from Open API spec:

email_addresses:
type: array
description: email addresses
example:
- Name1@example.com
- Name2@example.com
items:
type: string

Output:

[example: List [ "Name1@example.com", "Name2@example.com" ]

 

Meanwhile, the examples in response codes are nicely formatted with return characters and indenting.

 

Obviously this isn't a big problem for a simple, contrived example like I've provided, but in examples of complex arrays and objects, this is impacting the usability of the generated documentation.

 

Is anyone else experiencing this? Is there a way to get examples in the Schemas section to display with return characters and indenting? 

  • chichepo's avatar
    chichepo
    Champion Level 1

    Hi KayS 
    It seems to be the "normal" behavior of the schema area.
    As far as I know, this part is providing a "structural" presentation of the objects and their properties and I am not sure it is intended to "render" the objects content.

    In another hand, and for "rendering" of complex structure, I prefer to add "examples".