chore: Allow array matching
-
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:
@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?
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
Probably that whole expression needs to be something more like
path: [ '$.vc.type' ], filter: { type: 'array', contains: { const: 'TypeToSearchFor' } }