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
hello, currently it's not possible to define an example for a request body if I reference another object. only default/null values are shown as example.
This can be seen here: (example is empty since no properties defined for Configuration)
openapi: 3.0.0
info:
description: what a description
version: 1.0.0
title: API Docs
servers:
- url: 'https://some.url.net'
paths:
/some/path:
post:
summary: THis is a summary
description: This should be a long description...
requestBody:
description: Optional description in *Markdown*
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Configuration'
example:
sources:
- id: '1'
lat: 52.450411
lng: 13.43755
responses:
'200':
description: Totally cool
components:
schemas:
Configuration:
type: object
If we change this to that:
openapi: 3.0.0
info:
description: what a description
version: 1.0.0
title: API Docs
servers:
- url: 'https://some.url.net'
paths:
/some/path:
post:
summary: THis is a summary
description: This should be a long description...
requestBody:
description: Optional description in *Markdown*
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Configuration'
responses:
'200':
description: Totally cool
components:
schemas:
Configuration:
type: object
example:
sources:
- id: '1'
lat: 52.450411
lng: 13.43755
Then this works as expected, but forces me to use one example for all requests, I also validated this against another OpenAPI Viewer (Koumoul).
Hope this get's fixed soon.
Thanks, Daniel
The text was updated successfully, but these errors were encountered:
Swagger UI does not currently display the example and examples defined under content.<media-type> - see swagger-api/swagger-ui#3437. The workaround is to use schema-level examples.
hello, currently it's not possible to define an example for a request body if I reference another object. only default/null values are shown as example.
This can be seen here: (example is empty since no properties defined for Configuration)
If we change this to that:
Then this works as expected, but forces me to use one example for all requests, I also validated this against another OpenAPI Viewer (Koumoul).
Hope this get's fixed soon.
Thanks, Daniel
The text was updated successfully, but these errors were encountered: