nuts-foundation / nuts-foundation/nuts-node
Align presentation definition filter evaluation with JSON Schema semantics
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 28
- Forks
- 23
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 76
Description
Context
PEX defines a field's filter as a full JSON Schema (our own wire schema declares it as a draft-07 $ref), but matchFilter in vcr/pe implements a subset with semantics that deviate from JSON Schema. The load-time validator added in #4281 documents and flags the consequences (see the filter-semantics section in the Validate godoc), but the underlying evaluation is unchanged. This issue tracks the deliberate decision whether and how to align.
Current deviations
enumshadows every other keyword:type,constandpatternare not evaluated whenenumis set. JSON Schema ANDs all keywords.Filter.ConstandFilter.Enumare string-typed in Go: spec-valid numeric or boolean consts fail at parse with an unmarshal error, and values compare as strings only.patternis only evaluated whentypeis "string"; JSON Schema applies keywords per value type (a number trivially passespattern).- Numeric keywords (
minimum,maximum,multipleOf),minLength,formatand composition (allOf,anyOf,not) are not implemented. Since #4281 they are rejected bype.Validatefor own policy files instead of being silently dropped; remote PDs still parse leniently and match weaker than declared. - Consequence of 1-4: numeric claim values cannot be value-constrained at all. Documented guidance is to issue filterable claims as strings.
Considerations
- The evaluation machinery is already vendored:
santhosh-tekuri/jsonschemavalidates the PD documents themselves (vcr/pe/schema/v2). Filter-level evaluation would be wiring, not a new dependency, and schemas can be compiled once at PD load. - The capture-group value extraction in
matchFilteris a documented feature (docs/pages/deployment/policy.rst, "Extracting substrings with regular expressions") with no JSON Schema counterpart. Any alignment must preserve it or provide a migration. - Changing filter semantics changes live matching behavior for counterparty-supplied PDs as well as own policies; this needs release notes and possibly a compatibility window.
- Ecosystem context: OpenID4VP 1.0 replaces PEX with DCQL. Decision 2026-07-16: PEX field matching stays (DCQL is less expressive for our field-binding use); eventual dual support is an option. That bounds how much to invest here.
Relates to #4253 (the selection engine consumes filter evaluation results; pe.Validate encodes the current semantics and must be updated together with any change here).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with matchFilter in vcr/pe and the filter-semantics section of the Validate godoc, then compare them with the vendored JSON Schema validator under vcr/pe/schema/v2. Review the capture-group documentation in docs/pages/deployment/policy.rst and the selection-engine relationship in #4253. Done means a decided compatibility approach, updated validation and evaluation behavior, preserved or migrated capture groups, and documented release impact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100