Skip to main content

Crate siderite_validation

Crate siderite_validation 

Source
Expand description

Pydantic v2-inspired validation, serialization options and JSON Schema metadata for siderite.

  • Validate: type-driven prepare (coercion and checks on raw input, every error collected) plus validate (constraints and validators on the typed value).
  • parse_value / parse_json: the full pipeline, like model_validate.
  • ValidationContext / ModelConfig: locations, strictness, string transforms, extra-key policy and user data.
  • ModelHooks: field/model validators, computed fields, serializers.
  • Dump / DumpOptions: model_dump-style output options.
  • Schema: JSON Schema / OpenAPI 3.1 metadata.
  • Change: a partial-update field, absent or set (null included).
  • rules and constrained types.

Re-exports§

pub use change::Change;
pub use context::Extra;
pub use context::InputKind;
pub use context::ModelConfig;
pub use context::ValidationContext;
pub use dump::Dump;
pub use dump::DumpError;
pub use dump::DumpOptions;
pub use dump::FieldSet;
pub use error::FieldError;
pub use error::LocationItem;
pub use error::ValidationError;
pub use error::ValidationResult;
pub use hooks::ModelHooks;
pub use pipeline::parse_json;
pub use pipeline::parse_value;
pub use pipeline::text_pairs_to_value;
pub use pipeline::validate;
pub use rules::decimal_digits;
pub use rules::email;
pub use rules::ge;
pub use rules::gt;
pub use rules::ip;
pub use rules::le;
pub use rules::lt;
pub use rules::max_length;
pub use rules::min_length;
pub use rules::multiple_of;
pub use rules::pattern;
pub use rules::url;
pub use rules::uuid;
pub use schema::Schema;
pub use schema::SchemaConflict;
pub use schema::SchemaObject;
pub use schema::SchemaRegistry;
pub use schema::schema_for;
pub use types::BoundedFloat;
pub use types::BoundedI64;
pub use types::ConstrainedString;
pub use types::ConstrainedVec;
pub use types::Decimal;
pub use types::Email;
pub use types::FloatBounds;
pub use types::HttpUrl;
pub use types::IpAddress;
pub use types::Ipv4Address;
pub use types::Ipv6Address;
pub use types::NegativeInt;
pub use types::NonNegative;
pub use types::NonNegativeInt;
pub use types::Positive;
pub use types::PositiveInt;
pub use types::SecretString;
pub use types::UnboundedDecimal;
pub use types::UnitInterval;
pub use types::Url;
pub use types::Uuid;
pub use validate::Validate;

Modules§

change
Change: one field of a partial update, telling an absent field from null.
context
Validation context: current location, collected errors, model settings and user data shared with validators.
dump
Serialization options (Pydantic model_dump equivalents).
error
Structured validation errors with Pydantic-style location paths.
hooks
Model hooks: validators, computed fields and serializers.
model
Building blocks used by #[derive(Validate)] for structs with named fields. They are public so hand-written models can use them too; the reference model in this module’s tests shows the exact shape the derive generates.
pipeline
The complete validation pipeline: prepare → deserialize → validate.
rules
Reusable pure field validators.
schema
JSON Schema metadata shared with OpenAPI 3.1 / JSON Schema 2020-12.
types
Constrained newtypes that validate on construction and on deserialize.
validate
The Validate trait and its implementations for standard types.