question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add parent keys pattern to assertions context

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
RomanHotsiycommented, Jul 18, 2022

the key of an Operation Object, not its property

I interpret it as “the key of the operation object in the parent”

key and property while having slight semantic differences are the same in this context: essentially we’re validating json, and there is no difference between key and property in JSON.

I agree it’s a little bit confusing. I don’t have better ideas yet.

1reaction
adamaltmancommented, May 27, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

DRF: Simple foreign key assignment with nested serializers?
I've added two fields to ChildSerializer. parent = ParentSerializer(read_only=True) and parent_id =serializers.PrimaryKeyRelatedField(...., write_only=True, ...
Read more >
Evaluate Request XPath Assertion - TechDocs - Broadcom Inc.
The Evaluate Request XPath assertion is used to configure a specific XPath query pattern for incoming XML request messages.
Read more >
Go Concurrency Patterns: Context
A Context provides a key-value mapping, where the keys and values are both of type interface{} . Key types must support equality, and...
Read more >
googletest/advanced.md at main - GitHub
This document will show you more assertions as well as how to construct complex ... You can create an AssertionResult using one of...
Read more >
An Introduction to Schematron - XML.com
Assertions · The context element ( Person ) should have an attribute Title · The context element should contain two child elements, Name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found