Skip to main content

server_less_openapi/
error.rs

1//! Error types for OpenAPI composition.
2
3use thiserror::Error;
4
5/// Errors that can occur during OpenAPI composition.
6///
7/// `#[non_exhaustive]`: new error variants may be added in minor releases, so
8/// downstream `match`es must include a wildcard arm.
9#[derive(Debug, Error)]
10#[non_exhaustive]
11pub enum OpenApiError {
12    /// Schema conflict: same name, different definitions.
13    #[error("Schema conflict for '{name}': defined differently in multiple specs")]
14    SchemaConflict { name: String },
15
16    /// Invalid OpenAPI spec structure.
17    #[error("Invalid OpenAPI spec: {message}")]
18    InvalidSpec { message: String },
19
20    /// JSON serialization error.
21    #[error("JSON error: {0}")]
22    Json(#[from] serde_json::Error),
23}