Skip to main content

fastapi_openapi/
lib.rs

1//! OpenAPI 3.1 types and schema generation.
2//!
3//! This crate provides:
4//!
5//! - OpenAPI 3.1 document types
6//! - JSON Schema types
7//! - `JsonSchema` trait for compile-time schema generation
8//!
9//! # Example
10//!
11//! ```ignore
12//! use fastapi_openapi::{OpenApiBuilder, JsonSchema};
13//!
14//! #[derive(JsonSchema)]
15//! struct Item {
16//!     id: i64,
17//!     name: String,
18//! }
19//!
20//! let spec = OpenApiBuilder::new("My API", "1.0.0")
21//!     .route(&get_items_route())
22//!     .build();
23//! ```
24
25#![forbid(unsafe_code)]
26// Pedantic clippy lints allowed (style suggestions, not correctness issues)
27#![allow(clippy::uninlined_format_args)]
28#![allow(clippy::single_match)]
29#![allow(clippy::must_use_candidate)]
30#![allow(clippy::len_zero)]
31#![allow(clippy::single_match_else)]
32#![allow(clippy::needless_pass_by_value)]
33#![allow(clippy::needless_borrow)]
34#![allow(clippy::field_reassign_with_default)]
35#![allow(clippy::trivially_copy_pass_by_ref)]
36
37mod schema;
38mod spec;
39
40pub use schema::{
41    ArraySchema, EnumSchema, JsonSchema, ObjectSchema, OneOfSchema, PrimitiveSchema, RefSchema,
42    Schema, SchemaType,
43};
44pub use spec::{
45    Components, Example, HasParamMeta, Info, MediaType, OpenApi, OpenApiBuilder, Operation,
46    ParamMeta, Parameter, ParameterLocation, PathItem, RequestBody, Response, SchemaRegistry,
47    SchemaRegistryMut, Server, Tag,
48};