Expand description
Whole-document validation that collects every finding.
Graph::build stops at the first problem, which suits programs. People
editing a document want all of them at once, each pointing at the text
that caused it. validate_text parses a JSON or YAML document, checks
it against the node catalog and returns every Diagnostic with its
document path (graph.nodes[1].template), source position, and a
“did you mean” suggestion where one is close enough. When nothing is
wrong it also returns the compiled graph.
Checks, in addition to everything Graph::build enforces:
- unknown fields, for the document, graph, nodes, edges, policies and node
configs whose catalog schema is closed (
additionalProperties: false; every built-in kind). Plugin configs with open schemas take any key; - required config fields from the catalog schema;
- unknown node types, node ids in edges, parents and selectors, and edge handles the source node never selects;
- deprecated spellings (warnings).
Documents in the import layout (a top-level workflow or app key, or
nodes wrapped in data) are checked leniently: unknown fields are not
reported for them.
Re-exports§
pub use crate::source_map::DocPath;pub use crate::source_map::PathSegment;pub use crate::source_map::SourceMap;pub use crate::source_map::SourceSpan;
Structs§
- Diagnostic
- One validation finding.
- Validation
- Result of
validate_text.
Enums§
- Severity
- How serious a finding is.
Functions§
- suggest
- The closest candidate to
wordby edit distance, if it is close enough to be a likely typo (at most one edit per three characters, minimum one). A case-insensitive exact match always wins. - validate_
text - Parse, check and compile a JSON or YAML document, collecting every finding.
- validate_
value - Check and compile an already-decoded document (no source positions).