Oliver Nixon
06/07/2024, 3:19 PMAndrew Haines (Cerbos)
additionalProperties
to validate the values, possibly in combination with propertyNames
(if you want to also validate the keys match the format of your IDs). For example,
{
"$schema": "<https://json-schema.org/draft/2020-12/schema>",
"type": "object",
"properties": {
"workspaces": {
"type": "object",
"propertyNames": {
"pattern": "^[A-Z0-9]{12}$"
},
"additionalProperties": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"OWNER",
"MEMBER"
]
}
},
"required": [
"role"
]
}
}
},
"required": [
"workspaces"
]
}
You might not need an object in the values if you just need to map tenant ID to role.Andrew Haines (Cerbos)