Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Allow array matching #170

Draft
wants to merge 1 commit into
base: develop-20240918
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants