blazingly-contract 0.4.1

Runtime-neutral, canonical API contracts for Blazingly
Documentation

blazingly-contract

Runtime-neutral, canonical API contracts for Blazingly.

The crate owns the semantic source of truth shared by HTTP, MCP, AI documentation, internal RPC, and future mesh tooling:

  • versioned canonical encoding independent of declaration order;
  • model, input, output, typed-error, dependency, and security metadata;
  • aliases, nested validation, and stable custom-validator identities;
  • pull-based streaming request-body inputs without a runtime dependency;
  • MCP discovery and agent risk, confirmation, and idempotency policies;
  • SHA-256 contract fingerprints;
  • semantic compatibility reports.

It intentionally does not depend on Tokio, an HTTP server, an MCP transport, proc macros, or runtime dependency injection. The default std feature can be disabled for no_std + alloc consumers.

use blazingly_contract::{Compatibility, OperationContract};

fn verify_upgrade(previous: &OperationContract, current: &OperationContract) {
    let report = Compatibility::compare(previous, current);
    assert!(report.is_backward_compatible());
    println!("{}", current.fingerprint());
}

The Rust API follows Semantic Versioning. Canonical bytes and fingerprints are additionally versioned by CURRENT_CONTRACT_FORMAT_VERSION; changing the crate version does not silently change a contract fingerprint.

Version 0.4 uses canonical format 1.3, which carries value-type constraints on TypeDescriptor, including collection items and nested values, while preserving deterministic ordering and compatibility classification. Every operation fingerprint changes across the 1.2 to 1.3 move, so recorded compatibility baselines have to be recaptured. The new public constraints field breaks a struct literal that names every TypeDescriptor field: use TypeDescriptor::scalar/model/new, or add constraints: Vec::new().

Install

[dependencies]
blazingly-contract = "0.4"

Licensed under the MIT License.