Skip to content

chore: Allow array matching#170

Draft
sanderPostma wants to merge 1 commit intodevelop-20240918from
feature/pd-array-matching
Draft

chore: Allow array matching#170
sanderPostma wants to merge 1 commit intodevelop-20240918from
feature/pd-array-matching

Conversation

@sanderPostma
Copy link
Contributor

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • What is the current behavior? (You can also link to an open issue here)

  • What is the new behavior (if this is a feature change)?

  • Other information:

@sanderPostma sanderPostma marked this pull request as draft September 30, 2024 20:24
@sanderPostma
Copy link
Contributor Author

sanderPostma commented Sep 30, 2024

@nklomp
Does this make sense for supporting the following PD?

 "constraints": { "fields": [ { "path": [ "$.type", "$.vc.type[*]" ], "filter": { "type": "string", "pattern": "Woonplaatsverklaring" } } ] } 

The value of "$.vc.type[*]" is an array

0: "VerifiableCredential" 1: "Woonplaatsverklaring" 

Or should this have been working differently?

@nklomp
Copy link
Contributor

nklomp commented Sep 30, 2024

Huh, I would expect that filter to explode that array into separate strings. Only if you would list $.vc.type I would expect it to be an array. You need to look into the jsonpath spec for how it interprets the above, but I would expect you can match $.arrayExanple[*] against a string

@nklomp
Copy link
Contributor

nklomp commented Sep 30, 2024

Probably that whole expression needs to be something more like

path: [ '$.vc.type' ], filter: { type: 'array', contains: { const: 'TypeToSearchFor' } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants