Skip to main content

Module schema

Module schema 

Source
Expand description

Turning a command’s parameter schema into its command line.

A command already publishes a JSON Schema for its parameters, generated from the Rust type it deserializes. That schema knows the names, the types, which fields are required and what each one is for: everything a parser needs except presentation. Combined with the command’s CliRoute, it produces the ContractCommand both surfaces build their parser from.

This runs where the commands are declared, not in the parser. The contract it produces is the artifact that travels.

Functions§

contract_for
Build one command’s contract from what it publishes plus what it declares.
contract_with
Build a contract from a declared route, or from what the command already carries when it declares none.