Examples field is not validated against openAPI 3.0.0 spec
See original GitHub issueDescribe the bug No validation rule applies on the “Examples” field name defined in https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#exampleObject –> All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9.-_]+$.
To Reproduce I created an openapi.yaml containing the following lines
parameters:
- name: identifier
- required: true
in: path
allowEmptyValue: false
description: Some description
examples:
valid identifier:
description: 'Some description'
value: '49039557299384'
Running ‘redocly lint openapi.yaml’ returns that the file is valid.
The field name ‘valid identifier’ within the examples is invalid but I could not find any rule detecting this. An custom built assertion rule did not work because it only works for the value of a given property.
Expected behavior An error should be shown, that the ‘valid identifier’ is invalid
OpenAPI definition .redocly.yaml
lint:
extends:
- all
Specification version used: 3.0.0
Redocly Version(s) v1.0.0-beta.103
Node.js
Version(s)
v16.12.0
Issue Analytics
- State:
- Created a year ago
- Comments:9 (8 by maintainers)
Basing on the internal discussion it’s been decided to implement this as a separate rule with the
spec
prefix.Workaround for anyone who needs this now:
Create a Plugin/Custom Rule (use this guide: https://redocly.com/docs/cli/guides/response-contains-property/#response-contains-property.js) and use this code: