cfgmatic-schema 5.0.0

Schema and introspection types for cfgmatic configuration framework
Documentation
  • Coverage
  • 100%
    55 out of 55 items documented0 out of 19 items with examples
  • Size
  • Source code size: 16.88 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 21s Average build duration of successful builds.
  • all releases: 1m 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Mobydack

cfgmatic-schema

Schema and introspection types for cfgmatic v5.

cfgmatic-schema provides a stable manual schema model that can enrich merge reports with diagnostics.

Installation

[dependencies]
cfgmatic-schema = "5"
serde_json = "1"

Core types

  • SchemaNode
  • SchemaKind
  • EnvBinding
  • MergeHint
  • ValidationRule
  • ConfigSchema

Example

use cfgmatic_schema::{ConfigSchema, SchemaKind, SchemaNode};

struct AppConfig;

impl ConfigSchema for AppConfig {
    fn schema() -> SchemaNode {
        SchemaNode::new("/", "root", SchemaKind::Struct, "AppConfig").child(
            "server",
            SchemaNode::new("/server", "server", SchemaKind::Struct, "ServerConfig").child(
                "port",
                SchemaNode::new("/server/port", "port", SchemaKind::Integer, "u16"),
            ),
        )
    }
}

let schema = AppConfig::schema();
assert_eq!(schema.find("/server/port").unwrap().kind, SchemaKind::Integer);