Closed fabian-hk closed 2 years ago
You would check that the URI/string of the type value you are expecting is within the credential's type
property, like this:
Type array must contain one specific value:
"constraints": {
"fields": [
{
"path": [ "$.type" ],
"filter": {
"type": "array",
"contains": {
"enum": ["https://example.com/type"]
}
}
}
]
}
Type array must contain two different values:
"constraints": {
"fields": [
{
"path": [ "$.type" ],
"filter": {
"type": "array",
"allOf": [
{ "contains": { "enum": ["https://example.com/type"] } },
{ "contains": { "enum": ["SomeTypeString"] } }
]
}
}
]
}
Thank you for the examples!
I would like to know how to filter for a certain credential type. The example "Filter By Credential Type" in section 5 is a bit unclear to me because the filter filters for a single string. As far as I know, the type property is usually an array with two or more items. Shouldn't this be a JSON Schema that matches an array? Preferable an array with only the elements I want to have in there without additional elements?