-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser error on examples under response--should be allowed? #3687
Comments
Here's the correct version: responses:
'200':
description: Successful operation.
content:
application/json:
schema:
$ref: '#/components/schemas/Tower'
examples:
example-one:
value:
Status: Success
Data: Something Response |
This validates (no parser error), but it does not show the example in the generated documentation. |
UI does not render media type As a workaround, you can add components:
schemas:
Tower:
type: object
properties:
...
example:
Status: Success
Data: Something or components:
schemas:
Tower:
type: object
properties:
Status:
type: string
enum: [Success, Failure]
example: Success
Data:
type: string
example: Something |
That works for me, thank you. |
The parser is giving an error on the examples node under a responses node:
Schema error at paths['/getlevelstatus.json/{learner}'].get.responses['200']
should NOT have additional properties
additionalProperty: examples
Seems like this should be allowed. Tested in the swagger online editor. The documentation generated looks correct at this indent level. Indenting more or less gives further errors, or the example is not rendered in the documentation.
Demonstration API definition
Configuration (browser query string, constructor, config.yaml)
Expected Behavior
By my reading of your documentation, examples should be aligned directly under 'schema' in this case (child of application/json), however that generates more parser errors, and the example is not rendered in the documentation. Here I've aligned it with content because that's the only solution that shows the example in the documentation. One of these possibilities should work correctly.
Current Behavior
Possible Solution
Context
My spec won't validate.
The text was updated successfully, but these errors were encountered: