Raise Warning/Error for required but undefined properties #2437
Replies: 3 comments
-
Hey @MalteEbner! Thanks for pointing this out. While we don’t cover all cases with our OAS/AsyncAPI ruleset. It covers the most common ones, and then anybody can define custom rules extending the existing ruleset. This is certainly something we should add to our OAS ruleset as it's a pretty common validation use case. We'll probably take this up in the next few weeks. I’d really appreciate if you could create a pull request for this though or add issues for other cases that you expect in these rulesets. We love all kinds of contribution from community. |
Beta Was this translation helpful? Give feedback.
-
I'm also looking foward to a rule for OAS 2/3 (or more correctly, JSON schema) that detects undefined openapi: 3.0.3
components:
schemas:
foo:
type: object
required: [baz] # error: property "baz" is not defined
properties:
bar:
type: string |
Beta Was this translation helpful? Give feedback.
-
Hi, is there an update on this? |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Inside a schema: If a property is required, but not defined, no error or warning is thrown.
To Reproduce
schema.yml:
api.yml:
spectral lint api.yml
ExampleSchema.prop2
is undefined.Expected behavior
There is a warning or error that
ExampleSchema.prop2
is undefined.Environment:
Beta Was this translation helpful? Give feedback.
All reactions