Add regex validation pattern in schema version property#450
Conversation
h-mayorquin
left a comment
There was a problem hiding this comment.
Looks good overall. Two small things on the schema header:
$id resolves to 404. The $id added here points at https://probeinterface.readthedocs.io/schema/probe.json.schema, but nothing is served there: readthedocs publishes rendered docs under /en/<version>/, not the raw .schema file. It does not affect validation ($id is just an identifier), but it is misleading to anyone who tries to fetch the schema from it. Simplest fix is to point it at the raw file, which already resolves and needs no docs-build changes:
"$id": "https://raw.githubusercontent.com/SpikeInterface/probeinterface/main/src/probeinterface/schema/probe.json.schema"(Alternatively, drop $id entirely, or serve the schema under the docs domain if you want that URL to work.)
Pre-existing bug, noticed while here: the specification constraint is a no-op. The field uses "value": "probeinterface", but value is not a JSON Schema keyword, so it is ignored and any string passes ("", "openephys", etc. all validate). The keyword you want is const: {"type": "string", "const": "probeinterface"}. Not introduced by this PR, but since it is tightening the header it may be worth fixing in the same pass.
Fixes #448