opencrates 3.0.1

Enterprise-grade AI-powered Rust development companion with comprehensive automation, monitoring, and deployment capabilities
//! Generates and prints the OpenAPI specification for the OpenCrates server.
//!
//! This binary initializes the application's configuration and server components
//! without actually starting the server. It then generates the OpenAPI schema
//! based on the application's routes and serializes it to YAML format,
//! printing the result to standard output.
//!
//! This is intended to be used by the documentation generation scripts.

use opencrates::server::create_app;
use opencrates::utils::config::OpenCratesConfig;
use utoipa::OpenApi;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Initialize configuration
    let config = OpenCratesConfig::default();

    // Create the app to initialize the OpenAPI documentation
    let _app = create_app(config).await?;

    // Generate a basic OpenAPI schema
    #[derive(utoipa::OpenApi)]
    #[openapi(
        info(
            title = "OpenCrates API",
            version = "3.0.0",
            description = "OpenCrates API for Rust crate management and code generation"
        ),
        paths(),
        components(),
        tags()
    )]
    struct ApiDoc;

    // Generate the OpenAPI schema
    let openapi = ApiDoc::openapi();

    // Serialize the schema to YAML and print it
    let yaml_spec = serde_yaml::to_string(&openapi)?;
    println!("{}", yaml_spec);

    Ok(())
}