Expand description
Ferrin JSON Schema support.
Schema: a JSON Schema plus a typed validation function, created from a Rust type (schemarsderive +serdedeserialization), from a raw JSON Schema (validated withjsonschemawhen thejson-schema-validationfeature is enabled) or from a custom validator.SchemaDialect: draft-07 (default) or 2020-12 generation settings.SchemaTransform: provider-oriented schema rewrites (additionalProperties: false, OpenAI strict mode).partial_json: repair and parse truncated JSON produced by streaming models.json: JSON parsing with size and depth limits.
Design: docs/01-architecture/08-structured-output.md, ADR 0004.
§Attribution
Portions of this crate are derived from the Vercel AI SDK (Apache-2.0,
Copyright 2023 Vercel, Inc.), translated from TypeScript to Rust and
modified. See the NOTICE file in the crate root.
Re-exports§
pub use dialect::SchemaDialect;pub use json::ParseLimits;pub use partial_json::PartialParse;pub use partial_json::PartialParseState;pub use schema::Schema;pub use transform::SchemaTransform;pub use validation::ValidationIssue;pub use validation::ValidationIssues;pub use schemars;
Modules§
- dialect
- JSON Schema dialects used for generation.
- json
- JSON parsing with resource limits.
- partial_
json - Repair and parse truncated JSON.
- schema
- The
Schemaabstraction: a JSON Schema plus a typed validator. - transform
- Provider-oriented JSON Schema rewrites.
- validation
- Dynamic JSON Schema validation.
Structs§
- Json
Parse Error - Text could not be parsed as JSON.
- Type
Validation Context - Where a validated value came from, for error messages.
- Type
Validation Error - A value failed schema or type validation.
Enums§
- Schema
Error - Errors produced while parsing or validating JSON against a schema.
Traits§
- Json
Schema - A type which can be described as a JSON Schema document.
Derive Macros§
- Json
Schema - Derive macro for
JsonSchematrait.