Schema management
schema-management.RmdFor data validation, Validiraptor uses rulesets specified as JSON schemas. The rulesets are divided into topical and shared rules. Topical rules apply to a specific domain (e. g., a station report or a set of observation data), while shared rules lay down general specifications (date format, pattern for site codes etc.).
Linkage between topical and shared schema
Redefine shared rules only once, in the shared schema!
Example: The valid pattern for the SITE_CODE (a primary
identifier for various topical data) is defined only once, in the shared
schema, so that it has to be changed in one place only, should the
pattern be updated.
$id of the
shared schema and the $ref keyword in the topical schema.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://velociraptor.example/station",
"type": "object",
"properties": {
"SITE_CODE" : {"$ref": "shared#/definitions/SITE_CODE"},
"STYPE" : {
"description" : "spatial type; specified elsewhere",
"type" : "string", "enum" : ["PT", "AREA", "VLN", "HLN"]
},
...
}
Note that the URL-part of the URI (viz.
https://velociraptor.example of
https://velociraptor.example/station) does not resolve into
an existing web domain. Its sole function is to constitute a common
parent with the shared schema’s $id
(https://velociraptor.example/shared).
schema location
All schemas are stored in, and read from, JSON text files named
‘schemas at
https://github.com/eLTER-RI/validiraptor_schemas.
A snapshot of the schemas (as of 2024-03-19) is included in the
schemas subfolder of this app’s www static
asset folder. These are not read by the app, and may be outdated at the
time of reading.