Document Model
This section defines the fundamental structure and interpretation rules for Validation Rules (ELCL-VR) documents. These rules describe how validation rules map onto a parsed configuration document and how the resulting value tree is interpreted during validation.
Rules for Validation Rules Documents
Valid ELCL Document: A Validation Rules document must itself be a valid ELCL document and support all features provided by the parser.
Validation rules use the same syntax and structural concepts as regular configuration documents.
[server.name] type: "text"
Sections Define Nodes: Each section in a Validation Rules document defines the rules for exactly one Node in the validated document.
The section name represents the Name Path of the node being validated. When validation is applied to only a subtree of a configuration, the name path is interpreted as relative to the validated root.
[server.name] type: "text"
The example above defines rules for the node at
server.name, which corresponds to the following configuration:[server] name: "example"
See Node-Rules Definition for details about the contents of a node-rules definition.
Implicit Ancestors: Elements of a name path that are not explicitly defined are treated as implicit ancestor sections.
To reduce redundancy in validation rules documents, missing path elements implicitly create node-rules definitions for required sections with names.
[server.name] type: "text" default: "unknown"
In this example, the section
serveris not explicitly defined in the rules. It is therefore implicitly created as a required section with names.# ERROR: The required section "server" is missing.Existence Requirement: If a node-rules definition has no
defaultvalue and is not explicitly marked as optional, the corresponding node must exist in the configuration document.By default, every node defined by validation rules is required to appear in the value tree. A node can be made optional in exactly one of the following ways:
by providing a
defaultvalue, orby setting
is_optional: yes.
[server.name] type: "text"
[server] name: "" # VALID: The node exists, even if the value is empty.
Closed by Default: A configuration document must not contain nodes for which no matching node-rules definition exists.
A Validation Rules document is considered authoritative for the validated document or Value Tree. As a result, any value, section, or list that is not explicitly covered by validation rules is forbidden.
Important
Nodes are only exempt from the closed-by-default rule if they are explicitly covered by a node-rules definition of type
NotValidated.[server.name] type: "text"
[server] name: "example" [client] # ERROR: "client" is not defined in the validation rules.