Expand description
The JSON Schema of the crosswalk format, the document the packages publish as schemas/crossmap.schema.json.
It describes a crosswalk as a document may be written, so what crate::parse_crosswalk fills in (the rule lists,
a single-path rule’s to) is optional in it. It is written by hand here rather than derived from the parsed types,
because those are the parsed form (no keep, a to on every rule), and because the document has to stay the one
the TypeScript generator wrote from its Zod schemas, which it is byte for byte once canonicalised. What each rule
may carry comes from the parser’s own tables, the names of formats, functions and directions from their types, and
the path pattern from the constants of the path grammar, so the schema and the parser cannot list different
fields; the tests check that the parser requires exactly the fields the schema requires.
The when field is a reference to trilean’s published predicate schema, pinned to TRILEAN_VERSION, rather than
a copy of it, so the predicate grammar has one source of truth.
Constants§
- PACKAGE_
VERSION - The version of the crate, which names the published schema in its
$id. - TRILEAN_
VERSION - The version of the trilean npm package whose published schema the
whenreference names.
Functions§
- json_
schema - The JSON Schema document of the crosswalk format.
- json_
schema_ text - The document as it is published:
json_schemain its RFC 8785 canonical form, with no trailing newline, so the file’s bytes are exactly the canonical form of its own content. - path_
pattern - The pattern a path string matches: the path grammar of
crate::is_path, as an ECMAScript pattern with theuflag. - schema_
id - The address of the schema this crate’s format is published as.
- trilean_
schema_ id - The address of the trilean schema the
whenreference resolves in: the one published withTRILEAN_VERSION.