alux-shape-jsonschema 0.1.0

JSON Schema interpretation of ALUX shapes
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented0 out of 0 items with examples
  • Size
  • Source code size: 14.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 398.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • alux-network/alux-rust
    4 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tgrospic

alux-shape-jsonschema

alux-shape-jsonschema interprets an alux-shape shape as the JSON Schema that describes it.

A shape states what data is; this crate expresses the same meaning as JSON Schema. Named shapes are collected as definitions and referenced under the appropriate prefix: #/$defs/ for a standalone schema, or #/components/schemas/ for an OpenAPI document.

use alux_shape::{ShapeOf, Spelling};
use alux_shape_jsonschema::JsonSchemaShape;

let schema = JsonSchemaShape::new(Spelling::LowerCamel, "#/components/schemas/");
let reading = u32::shape_of(&schema).into_value();

assert_eq!(reading, serde_json::json!({ "type": "integer", "format": "int32", "minimum": 0 }));