We are interfacing with a hardware device, where we are uploading json configuration files.
The device cannot handle non-ascii characters anywhere on the json - not even if escaped use \uXXXX
.
We are already doing schema validation using draft-07, so we would like to specify this constraint in the schema. We can put regex constraints on all our strings.
But the problem is that we must have additionalProperties: true
in several places - and the additional properties must allow any json values. But we must also constrain these to contain only ascii characters.
Is this possible to specify in the schema?
Sample simplified schema:
{
"$schema":"http://json-schema.org/draft-07/schema#",
"type":"object",
"properties":
{
"channel":
{
"type":"array",
"items":
{
"type":"object",
"properties": { "name":{"type":"string"} },
"required":["name"],
"additionalProperties":true
}
}
},
"required":["channels"],
"additionalProperties":true
}
Sample json which should not validate:
{
"channels":[ {"name":"temperature", "input": "temp in °C"}],
"other":[ {"mykey": "ü"}],
"danish": "æøå"
}