harmony_dsl/lib.rs
1//! # harmony-dsl
2//!
3//! TOML Schema DSL definitions for Harmony Proxy configuration files.
4//!
5//! This crate contains schema definitions used for validating Harmony Proxy
6//! configuration files:
7//!
8//! - `harmony-config-schema.toml` - Main gateway configuration schema
9//! - `harmony-pipeline-schema.toml` - Pipeline configuration schema
10//!
11//! ## Usage
12//!
13//! These schema files are included in the crate and can be accessed by
14//! consumers for validation purposes. The schema files are located in the
15//! crate root and can be referenced when building validators.
16//!
17//! ## Schema Files
18//!
19//! ### harmony-config-schema.toml
20//!
21//! Defines the structure for main gateway configuration files (`config.toml`).
22//! Includes validation rules for:
23//! - Proxy settings (ID, logging, paths)
24//! - Network definitions (HTTP listeners, WireGuard)
25//! - Management API configuration
26//! - Storage backends (filesystem, S3)
27//! - Service type registry
28//!
29//! ### harmony-pipeline-schema.toml
30//!
31//! Defines the structure for pipeline configuration files (`pipelines/*.toml`).
32//! Includes validation rules for:
33//! - Pipeline routing definitions
34//! - Endpoint configurations (how requests arrive)
35//! - Backend configurations (where requests go)
36//! - Middleware instances (transform, auth, etc.)
37//!
38//! ## Cross-Language Support
39//!
40//! These schemas are designed to work with both:
41//! - **Rust** (harmony-proxy) - Local validation before proxy startup
42//! - **PHP** (Runbeam Cloud API) - Remote validation and configuration management
43//!
44//! ## Version
45//!
46//! Schema version: Config 1.8.0 / Pipeline 1.8.0
47//!
48//! ## License
49//!
50//! MIT License - See LICENSE file for details
51
52/// The contents of the harmony-config-schema.toml file
53pub const CONFIG_SCHEMA: &str = include_str!("../harmony-config-schema.toml");
54
55/// The contents of the harmony-pipeline-schema.toml file
56pub const PIPELINE_SCHEMA: &str = include_str!("../harmony-pipeline-schema.toml");
57
58#[cfg(test)]
59mod tests {
60 use super::*;
61
62 #[test]
63 fn config_schema_is_not_empty() {
64 assert!(!CONFIG_SCHEMA.is_empty());
65 assert!(CONFIG_SCHEMA.contains("[schema]"));
66 }
67
68 #[test]
69 fn pipeline_schema_is_not_empty() {
70 assert!(!PIPELINE_SCHEMA.is_empty());
71 assert!(PIPELINE_SCHEMA.contains("[schema]"));
72 }
73}