1
0
forked from M-Labs/artiq

jsondesc: Disallow unknown properties

This helps to catch typos made in drafting core device schemata.
For instance, previously typo'ing `"edge_counter": true` as
`"edge_counters": true` would lead to it silently being ignored.

This required switching to a (meta-)schema version more recent by
one release, as unevaluatedProperties is not supported in draft-7
yet.
This commit is contained in:
David Nadlinger
2026-01-31 22:43:46 +00:00
parent 0570d61300
commit 8a2d7dab94
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"$id": "https://m-labs.hk/kasli_generic.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "Kasli variant description",
"type": "object",
@@ -166,6 +166,7 @@
}
},
"required": ["type"],
"unevaluatedProperties": false,
"allOf": [{
"title": "DIO",
"if": {

View File

@@ -1,6 +1,6 @@
from os import path
import json
from jsonschema import Draft7Validator, validators
from jsonschema import Draft201909Validator, validators
def extend_with_default(validator_class):
validate_properties = validator_class.VALIDATORS["properties"]
@@ -23,7 +23,7 @@ schema_path = path.join(path.dirname(__file__), "coredevice_generic.schema.json"
with open(schema_path, "r") as f:
schema = json.load(f)
validator = extend_with_default(Draft7Validator)(schema)
validator = extend_with_default(Draft201909Validator)(schema)
def load(description_path):
with open(description_path, "r") as f: