Skip to main content

Module api

Module api 

Source
Expand description

The high-level API of the crate: the operations the decl command line offers, in the same vocabulary — evaluate binds inputs and returns outputs, check, validate, evaluate_source, format_source — for programs that would otherwise assemble parser, checker, and engine by hand (those modules are public too). The npm package and the Python package offer the same functions with the same semantics.

Re-exports§

pub use crate::pipeline::evaluate_source;
pub use crate::pipeline::Report;

Structs§

DeclError
An operation failed; diagnostics carries the report (empty for a usage error such as an unknown input or root).
Diagnostic
One diagnostic, in the report’s field order (§12.2).
EvaluateOptions
What evaluate binds and returns.

Enums§

Document
A document to bind to an input: the path of a JSON file, or its JSON text.

Functions§

check
Parse and statically check entry files (module-aware); empty means clean.
evaluate
Evaluate a module: bind the input documents, run the pipeline, and return the requested roots’ documents (canonical JSON text) by name. Fails with the diagnostics on any error-severity outcome.
format_source
The canonical formatting of a source text; fails when it does not parse.
validate
Validate a file: static checks, then evaluation with the input documents bound; returns every diagnostic (all severities). Fails when the file does not parse.