Skip to content

[discussion]: Support union JSON path operator in RequiredCheck as well? #193

@martonvago

Description

@martonvago

In Sprout, we often want the same check for fields at many different JSON paths.

In JSON path notation, you can express the union of paths in two ways:

  1. $.name | $.title
  2. $['name', 'title']

Either of these will return 2 matches: name and title.

This means we can write one Exclusion like

Exclusion(jsonpath="$.name | $.title", type="required")

to exclude required issues at both paths.
The same is true for CustomCheck.

We disabled this for RequiredCheck in the first pass for simplicity (also, I hadn't looked into it yet fully), but we could allow it. Should we?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions