Add parent keys pattern to assertions context
See original GitHub issueIs your feature request related to a problem? Please describe.
The context object allows for targeting exact keys. However, sometimes you need more flexibility and can’t determine the exact preset parent key names. An example would be a path with a template parameter (it has {
and }
characters in it).
Describe the solution you’d like
Context object (current)
Property | Type | Description |
---|---|---|
type | string |
REQUIRED. One of the OpenAPI node types. |
matchParentKeys | [string ] |
The list of parent object key names to evaluate with respect to the subject. |
excludeParentKeys | [string ] |
The list of parent object key names to not evaluate with respect to the subject. |
Context object (desired)
Property | Type | Description |
---|---|---|
type | string |
REQUIRED. One of the OpenAPI node types. |
includeParentKeys | [string ] |
The list of the exact parent object key names to evaluate with respect to the subject. |
excludeParentKeys | [string ] |
The list of the exact parent object key names to not evaluate with respect to the subject. |
matchParentKeys | string |
A pattern that will evaluate against the parent keys. |
Notice that we rename matchParentKeys
to includeParentKeys
and we use matchParentKeys
keys for the new assertion context condition.
There is some discussion if the includeParentKeys
should be mutually exclusive with matchParentKeys
and excludeParentKeys
. (I don’t care either way.)
Describe alternatives you’ve considered
One alternative considered was removing the exact parent keys and have a pattern only. This makes it more difficult to read and write the exact key use cases.
Additional context
Attempting to limit context to paths with path template variables.
Issue Analytics
- State:
- Created a year ago
- Comments:18 (18 by maintainers)
I interpret it as “the key of the operation object in the parent”
key
andproperty
while having slight semantic differences are the same in this context: essentially we’re validating json, and there is no difference betweenkey
andproperty
in JSON.I agree it’s a little bit confusing. I don’t have better ideas yet.
It’s not a property of Operation from what I see but a property that contains the Operation as its value. Operation has these properties like
tags
,summary
:https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-8
It’s a property of the Path Item object:
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object