You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there any plans to add support for yaml media type examples? Currently examples given as schema objects will render as either json or xml, but to get them to display as yaml I must copy and paste a separate example as a multi-line string.
Here is an example spec demonstrating the different behaviours:
openapi: 3.0.0info:
version: '0.1'title: Yaml vs Json Examplesdescription: ''paths:
/resource1:
post:
summary: Add some resource - examples are json or xmloperationId: myOp1responses:
'201':
description: resource created'400':
description: Invalid inputrequestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsJson:
$ref: '#/components/examples/example1'application/yaml:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsJson:
$ref: '#/components/examples/example1'application/xml:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsXml:
$ref: '#/components/examples/example1'description: Resource to add /resource2:
post:
summary: Add some resource - examples are string or yamloperationId: myOp2responses:
'201':
description: resource created'400':
description: Invalid inputrequestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsString:
$ref: '#/components/examples/example2'application/yaml:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsYaml:
$ref: '#/components/examples/example2'application/xml:
schema:
$ref: '#/components/schemas/ModelA'examples:
willRenderAsYaml:
$ref: '#/components/examples/example2'description: Resource to add components:
examples:
example1:
summary: Example as schema objectvalue:
PropertyA: fooPropertyB: bar# to get example1 to show as YAML have to copy paste # and pipe the valueexample2:
summary: Example as literal YAML stringvalue: | PropertyA: foo PropertyB: bar schemas:
ModelA:
type: objectproperties:
PropertyA:
type: stringPropertyB:
type: string
The text was updated successfully, but these errors were encountered:
mathis-m
changed the title
Are there any plans to add support for yaml media type examples? Currently examples given as schema objects will render as either json or xml, but to get them to display as yaml I must copy and paste a separate example as a multi-line string.
Are there any plans to add support for yaml media type examples?
Jan 20, 2021
So... while application/yaml isn't an actual media type, and that there exists multiple ways to express yaml, e.g. 'text/yaml', based on the xml implementation as precedence, we can move forward with this as a new feature.
Are there any plans to add support for yaml media type examples? Currently examples given as schema objects will render as either json or xml, but to get them to display as yaml I must copy and paste a separate example as a multi-line string.
Here is an example spec demonstrating the different behaviours:
Thanks
Originally posted by @deltafsdevelopment in #6470 (comment)
The text was updated successfully, but these errors were encountered: