A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI (v3.1, v3.0, and v2.0), Arazzo v1.0, as well as AsyncAPI v2.x.
3. Run this CLI command '....'
```bash
spectral lint {openapi,asyncapi}.yml --ruleset .spectral.yml
See error
/Users/niels/spectral-repro/asyncapi.yml
1:1 warning asyncapi-info-contact Info object must have "contact" object.
1:1 warning asyncapi-info-description Info "description" must be present and non-empty string.
1:1 warning asyncapi-info-license Info object must have "license" object.
1:1 error asyncapi-schema Object must have required property "info"
1:1 warning asyncapi-servers AsyncAPI object must have non-empty "servers" object.
1:1 warning asyncapi-tags AsyncAPI object must have non-empty "tags" array.
5:15 warning asyncapi-operation-description Operation "description" must be present and non-empty string. channels./.subscribe
31:9 error asyncapi-payload-examples Property "prop2" is not expected to be here components.schemas.Foo.examples[0]
31:9 error asyncapi-payload-examples Property "prop1" is not expected to be here components.schemas.Foo.examples[0]
31:9 error asyncapi-schema-examples Property "prop2" is not expected to be here components.schemas.Foo.examples[0]
31:9 error asyncapi-schema-examples Property "prop1" is not expected to be here components.schemas.Foo.examples[0]
/Users/niels/spectral-repro/openapi.yml
1:1 warning info-contact Info object must have "contact" object.
1:1 warning info-description Info "description" must be present and non-empty string.
1:1 warning oas3-api-servers OpenAPI "servers" must be present and non-empty array.
1:1 error oas3-schema Object must have required property "info".
5:9 warning oas3-unused-component Potentially unused component has been detected. components.schemas.Foo
16:15 error oas3-valid-schema-example Property "prop2" is not expected to be here components.schemas.Foo.example
**Expected behavior**
`asyncapi-payload-examples`, `asyncapi-schema-examples`, and `oas3-valid-schema-example`, should not be thrown.
**Environment (remove any that are not applicable):**
- Library version: 6.11.0
- OS: macOS 14.2.1
You can find a repo reproducing the issue here: https://github.com/Swimburger/spectral-repro
Describe the bug When using
allOf
to merge schema's, the example property in OpenAPI, and examples in AsyncAPI, is incorrectly validated.To Reproduce
/Users/niels/spectral-repro/openapi.yml 1:1 warning info-contact Info object must have "contact" object. 1:1 warning info-description Info "description" must be present and non-empty string. 1:1 warning oas3-api-servers OpenAPI "servers" must be present and non-empty array. 1:1 error oas3-schema Object must have required property "info". 5:9 warning oas3-unused-component Potentially unused component has been detected. components.schemas.Foo 16:15 error oas3-valid-schema-example Property "prop2" is not expected to be here components.schemas.Foo.example
✖ 17 problems (7 errors, 10 warnings, 0 infos, 0 hints)