Skip to main content

Module schema

Module schema 

Source
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 envelope
  • api-error.schema.json - Error response structure
  • error-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§

ErrorCatalog
Complete error catalog for machine consumption.
ErrorCategoryEntry
Machine-readable error category entry.
ErrorCodeEntry
Machine-readable error code entry.
SchemaExportResult
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.