//! OpenAPI spec generation and endpoint. //! //! Collects documented API operations into a single spec served at //! `/api/openapi.json`. Only public/stable endpoints are included — //! internal dashboard and HTMX endpoints are intentionally excluded. use axum::{Json, response::IntoResponse}; use utoipa::OpenApi; /// OpenAPI spec collecting all documented endpoints. /// /// Add new handler paths and schema types here as endpoints are annotated. #[derive(OpenApi)] #[openapi( info( title = "MakeNotWork API", description = "Creator marketplace API. Only public and stable endpoints are documented.", version = env!("CARGO_PKG_VERSION"), license(name = "PolyForm Noncommercial 1.0.0"), ), paths( // License Keys crate::routes::api::license_keys::validate_key, crate::routes::api::license_keys::deactivate_key, crate::routes::api::license_keys::key_status, crate::routes::api::license_keys::license_verify, crate::routes::api::license_keys::license_deactivate, crate::routes::api::license_keys::license_text, // SyncKit — Auth crate::routes::synckit::auth::sync_auth, crate::routes::synckit::auth::validate_app, // SyncKit — Sync crate::routes::synckit::sync::sync_push, crate::routes::synckit::sync::sync_pull, crate::routes::synckit::sync::sync_status, crate::routes::synckit::sync::register_device, crate::routes::synckit::sync::list_devices, crate::routes::synckit::sync::delete_device, crate::routes::synckit::sync::put_sync_key, crate::routes::synckit::sync::get_sync_key, // SyncKit — Blobs crate::routes::synckit::blobs::blob_upload_url, crate::routes::synckit::blobs::blob_confirm_upload, crate::routes::synckit::blobs::blob_download_url, ), components(schemas( // License Keys crate::routes::api::license_keys::ValidateKeyRequest, crate::routes::api::license_keys::ValidateKeyResponse, crate::routes::api::license_keys::ValidateKeyLicense, crate::routes::api::license_keys::DeactivateKeyRequest, crate::routes::api::license_keys::DeactivateKeyResponse, crate::routes::api::license_keys::KeyStatusResponse, crate::routes::api::license_keys::KeyStatusLicense, crate::routes::api::license_keys::LicenseVerifyRequest, crate::routes::api::license_keys::LicenseVerifyResponse, crate::routes::api::license_keys::LicenseDeactivateRequest, // SyncKit crate::routes::synckit::SyncAuthRequest, crate::routes::synckit::SyncAuthResponse, crate::routes::synckit::ValidateAppQuery, crate::routes::synckit::ValidateAppResponse, crate::routes::synckit::PushRequest, crate::routes::synckit::ChangeEntry, crate::routes::synckit::PushResponse, crate::routes::synckit::PullRequest, crate::routes::synckit::PullResponse, crate::routes::synckit::PullChangeEntry, crate::routes::synckit::SyncDeviceResponse, crate::routes::synckit::RegisterDeviceRequest, crate::routes::synckit::SyncStatusResponse, crate::routes::synckit::PutKeyRequest, crate::routes::synckit::GetKeyResponse, crate::routes::synckit::BlobUploadUrlRequest, crate::routes::synckit::BlobUploadUrlResponse, crate::routes::synckit::BlobConfirmRequest, crate::routes::synckit::BlobDownloadUrlRequest, crate::routes::synckit::BlobDownloadUrlResponse, )), tags( (name = "License Keys", description = "Public license key validation, activation, and deactivation. Stable API — response shapes are frozen."), (name = "SyncKit", description = "E2E encrypted cloud sync for indie apps. JWT auth via /api/v1/sync/auth, then Bearer token on all other endpoints."), ), security( ("bearer" = []), ), )] struct ApiDoc; /// Serve the OpenAPI spec as JSON. pub async fn openapi_json() -> impl IntoResponse { Json(ApiDoc::openapi()) }