Expand description
JSON Schema Generation for RCH API Types
This module provides schema generation capabilities for API documentation and machine-readable specifications.
§Generated Schemas
api-response.schema.json- The unified API response envelopeapi-error.schema.json- Error response structureerror-codes.json- Machine-readable error code catalog
§Example
use rch_common::api::schema::{generate_api_response_schema, generate_error_catalog};
// Generate API response schema
let schema = generate_api_response_schema();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
// Generate error catalog
let catalog = generate_error_catalog();
println!("{}", serde_json::to_string_pretty(&catalog).unwrap());Structs§
- Error
Catalog - Complete error catalog for machine consumption.
- Error
Category Entry - Machine-readable error category entry.
- Error
Code Entry - Machine-readable error code entry.
- Schema
Export Result - Schema export result containing all generated schemas.
Functions§
- export_
schemas - Export all schemas to the specified directory.
- generate_
api_ error_ schema - Generate JSON Schema for API errors.
- generate_
api_ response_ schema - Generate JSON Schema for the API response envelope.
- generate_
error_ catalog - Generate the complete error catalog as a structured object.