Skip to main content

Crate json_schema_rs

Crate json_schema_rs 

Source
Expand description

Generate Rust structs from JSON Schema.

Accepts a JSON Schema, parses it into an in-memory model, and emits Rust source to a writer. Supported keywords and types are documented in the README.

Re-exports§

pub use code_gen::CodeGenBackend;
pub use code_gen::CodeGenError;
pub use code_gen::CodeGenResult;
pub use code_gen::CodeGenSettings;
pub use code_gen::CodeGenSettingsBuilder;
pub use code_gen::DedupeMode;
pub use code_gen::GenerateRustOutput;
pub use code_gen::ModelNameSource;
pub use code_gen::RustBackend;
pub use code_gen::generate_rust;
pub use json_pointer::JsonPointer;
pub use json_pointer::JsonPointerError;
pub use json_schema::JsonSchema;
pub use json_schema::JsonSchemaParseError;
pub use json_schema::JsonSchemaParseResult;
pub use json_schema::JsonSchemaSettings;
pub use json_schema::JsonSchemaSettingsBuilder;
pub use json_schema::SpecVersion;
pub use json_schema::resolved_spec_version;
pub use reverse_code_gen::ToJsonSchema;
pub use validator::OrderedF64;
pub use validator::ValidationError;
pub use validator::ValidationResult;
pub use validator::validate;

Modules§

code_gen
Code generation: schema → source in a target language.
json_pointer
JSON Pointer (RFC 6901): type and helpers for building and parsing pointer strings.
json_schema
JSON Schema parsing, model, and settings.
reverse_code_gen
Reverse codegen: Rust types to JSON Schema.
sanitizers
Sanitization of names and paths for Rust codegen and CLI output.
validator
JSON Schema validation: schema + instance → validation result with all errors.