scim_server/schema/mod.rs
1//! Schema definitions and validation for SCIM resources.
2//!
3//! This module provides the schema registry and validation engine for SCIM resources,
4//! implementing the core User schema as defined in RFC 7643 with comprehensive
5//! validation capabilities.
6//!
7//! ## Organization
8//!
9//! The schema module is organized into several sub-modules:
10//!
11//! - [`types`] - Core schema data structures (Schema, AttributeDefinition, etc.)
12//! - [`registry`] - Schema registry for loading and managing schemas
13//! - [`validation`] - Comprehensive validation logic for SCIM resources
14//! - `tests` - Test cases for schema functionality
15//!
16//! ## Usage
17//!
18//! ```rust
19//! use scim_server::schema::{SchemaRegistry, OperationContext};
20//! use serde_json::json;
21//!
22//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! // Create a schema registry
24//! let registry = SchemaRegistry::new()?;
25//!
26//! // Validate a SCIM resource
27//! let user = json!({
28//! "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
29//! "userName": "jdoe@example.com"
30//! });
31//!
32//! registry.validate_json_resource_with_context("User", &user, OperationContext::Create)?;
33//! # Ok(())
34//! # }
35//! ```
36
37pub mod embedded;
38pub mod registry;
39pub mod types;
40pub mod validation;
41
42#[cfg(test)]
43mod tests;
44
45// Re-export the main types for convenience
46pub use registry::SchemaRegistry;
47pub use types::{AttributeDefinition, AttributeType, Mutability, Schema, Uniqueness};
48pub use validation::OperationContext;