Skip to main content

Module output

Module output 

Source
Expand description

Structured output envelopes, renderers, schemas, and field projection. Structured output envelopes and renderers.

Command handlers return JSON-serializable data and a backend system id. The middleware wraps that data in an Envelope, applies filtering, pagination, JMESPath expressions, field projection, and then renders the result as JSON, human text, or TOON.

JSON is the default for the Rust crate. Human output is intended for terminal readability, and TOON remains available as an explicit migration format.

Re-exports§

pub use crate::error::DetailedError;
pub use crate::error::ExitCoder;
pub use crate::error::exit_code_for_error;
pub use crate::error::exit_code_for_exit_coder;

Structs§

Envelope
Top-level output envelope rendered for successful and failed commands.
ErrorEnvelope
Structured error payload in an Envelope.
FieldInfo
Compact field summary used in help text and schema output.
FieldTree
Parsed field-selection tree.
HumanViewDef
Human view definition keyed by schema id.
HumanViewRegistry
Registry of human column and custom-renderer views.
HumanViewRenderer
Custom human renderer wrapper.
Metadata
Execution metadata attached to an Envelope.
NextAction
A suggested follow-up command the caller can run next.
NextActionParam
Metadata hint for a parameter in a NextAction command template.
OutputField
Manual output field descriptor.
PaginationMeta
Client-side pagination metadata.
PipelineOpts
Options for the output pipeline.
RendererFactory
Small rendering facade for callers that prefer an object-style renderer.
SchemaInfo
Schema information returned by --schema.
SchemaRegistry
Registry for command output schemas.
TableColumn
Column definition for registered human table views.

Enums§

OutputFormat
Supported output formats.

Traits§

OutputSchema
Trait for manually declared output schemas.

Functions§

apply_pipeline
Applies filter, pagination, expression, and field projection in framework order.
build_detailed_error_envelope
Builds an error envelope from a DetailedError.
build_error_envelope
Builds an error envelope, preserving structured details from known error types.
fields_for
Converts an OutputSchema implementation to compact field info.
fields_from_json_schema
Extracts compact field summaries from a JSON Schema object.
filter_fields
Applies field projection to objects or arrays of objects.
format_help_section
Formats compact field summaries for command long help.
get_global_schema_by_path
Looks up a process-global schema by command path.
global_human_view_registry_snapshot
Returns a snapshot of the process-global human view registry.
global_schema_registry_snapshot
Returns a snapshot of the process-global schema registry.
is_valid_output_format
Returns true when format is supported by the framework.
json_schema_for
Generates JSON Schema for a Rust type.
json_schema_info
Builds schema info from a Rust type’s JSON Schema.
lookup_global_human_view_columns
Looks up global columns for a schema id.
lookup_global_human_view_func
Looks up a global custom renderer for a schema id.
parse_fields
Parses comma-separated field paths.
register_global_human_view
Registers a process-global column view.
register_global_human_view_func
Registers a process-global custom human renderer.
register_global_json_schema
Registers a process-global JSON Schema.
register_global_schema
Registers a process-global manual schema.
register_global_schema_fields
Registers process-global compact field summaries.
register_global_schema_info
Registers process-global schema info.
render
Renders an envelope in the requested format.
render_data
Wraps data in a success envelope and renders it.
render_data_format
Parses an output format string, wraps data in a success envelope, and renders it.
render_detailed_error
Wraps a detailed error in an error envelope and renders it.
render_detailed_error_format
Parses an output format string, wraps a detailed error, and renders it.
render_error
Wraps an error in an error envelope and renders it.
render_error_format
Parses an output format string, wraps an error, and renders it.
render_format
Parses an output format string and renders an envelope.
render_human
Renders an envelope using generic human output.
render_human_with_registry
Renders an envelope using a human view registry.
render_human_with_registry_for_schema
Renders an envelope using registry entries for a specific schema id.
render_human_with_registry_selected
Renders an envelope using a registered view, narrowed to fields.
render_human_with_view
Renders an envelope using explicit table columns.
render_json
Renders an envelope as pretty JSON.
render_toon
Renders an envelope in the TOON migration format.
write_render
Writes rendered envelope output to a writer.

Type Aliases§

HumanViewFn
Function used to render custom human output for a JSON value.