Build out note section in single-level required schema
Closed this issue · 2 comments
Currently, the notes section of the single_level_required.json is a placeholder.
We need to build out the schema to check for the scope and contents and conditions governing access notes.
See PR #40 for additional information.
I'm continuing to look into this, but wanted to note what is NOT working so far. Here's the relevant portion of the schema that I've tried to use anyOf
with:
"notes": {
"type": "array",
"minItems": 2,
"items": {
"anyOf": [
{
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"const": "accessrestrict"
}
}
}
]
}
I ran it against our valid fixture in https://jsonschemalint.com/#!/version/draft-07/markup/json , and the notes that are not required (but we can have anyway) caused validation to fail:
Figured it out. Instead of using items
, we need to use contains
. So something like:
"notes": {
"type": "array",
"minItems": 2,
"contains": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"const": "accessrestrict"
}
}
},
"contains": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"const": "scopecontent"
}
}
}
}
Though we will likely want to include a bit more, so may want to use subschemas for these notes.