Skip to content
RUMLRUML

Open Format for Digital Law

2.6 File Validation

2.6 File Validation

The structure of a RUML file is defined by the JSON Schema ruml.schema.json (draft 2020-12).

When Loading a RUML File, the Following MUST Be Performed:

  1. Format check:
  • $format MUST be “RUML” (Rule FMT-03FMT-03 $format MUST be "RUML".)
  • $specVersion MUST be a supported version (Rule FMT-04FMT-04 $specVersion MUST be one of the versions listed in the enum of $specVersion in the schema., Rule FMT-09FMT-09 A parser MUST accept a file whose $specVersion has its own MAJOR version and a MINOR version up to its own, and MUST reject a file with a higher MINOR version or a different MAJOR version.)
  1. Structure check:
  • All required fields MUST be present
  • Data types MUST conform to the specifications in Chapter 3.2 (Rule FMT-13FMT-13 Every field value MUST have the data type 3.2.3 gives it: a Number a JSON number, a Boolean a JSON Boolean, a DateTime an RFC 3339 date-time, an Enum one of the values defined for the field, an Object a JSON object, an Array a JSON array.)
  1. Hash verification (only when using the container format):
  • Hash verification is performed at container level (see Chapter 7)
  • If a hash is present, it MUST be verified; if there is a mismatch, processing MUST be refused

Identifier check:

  • LexIDs MUST be unique; a reused modular node still has exactly one nodes entry (Rule FMT-12FMT-12 A LexID MUST NOT occur more than once as a key of rulemap.nodes.)
  • UUIDs MUST match the pattern (Rule FMT-10FMT-10 Every UUID MUST be a lowercase UUID version 4 (pattern in 2.5).)
  • The nodes object MUST contain an entry with key "1" (root node) (Rule FMT-08FMT-08 rulemap.nodes MUST contain an entry with key "1", the root node.)

Validation of RUML-EXT Files

When loading a RUML-EXT file (.ruml-ext, $format: "RUML-EXT"), a validator MUST additionally check:

  1. Referential integrity of $base: The $base.id MUST match the metadata.id of the referenced base RUML file, and $base.hash MUST match the current hash of the base file (Rule CAP-24CAP-24 Before a merge, the $base.id of a RUML-EXT file MUST equal the metadata.id of the base file, and its $base.hash the hash of the base file's canonical form; otherwise the parser MUST abort the merge. Each RUML-EXT file is checked on its own.).
  2. UUID existence: Every UUID in the nodes object of the EXT file MUST exist in the base RUML file. UUIDs without corresponding nodes in the base file MUST be treated as errors (Rule CAP-26CAP-26 Every node UUID in the nodes of a RUML-EXT file MUST be the id of a node of the base file.).

See Chapter 4.5 for the complete RUML-EXT specification.