diff --git a/crates/aide-axum-typed-multipart/src/lib.rs b/crates/aide-axum-typed-multipart/src/lib.rs index c7992b4..09b6c12 100644 --- a/crates/aide-axum-typed-multipart/src/lib.rs +++ b/crates/aide-axum-typed-multipart/src/lib.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use aide::{ - gen::GenContext, + generate::GenContext, openapi::{MediaType, Operation, RequestBody, SchemaObject}, operation::set_body, OperationInput, diff --git a/crates/aide-macros/src/lib.rs b/crates/aide-macros/src/lib.rs index b4af656..ee10b11 100644 --- a/crates/aide-macros/src/lib.rs +++ b/crates/aide-macros/src/lib.rs @@ -125,7 +125,7 @@ pub fn derive_operation_io(ts: TokenStream) -> TokenStream { ts.extend(quote! { impl #i_gen aide::OperationInput for #name #t_gen #w_gen { fn operation_input( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, operation: &mut aide::openapi::Operation ) { <#input as aide::OperationInput>::operation_input( @@ -142,7 +142,7 @@ pub fn derive_operation_io(ts: TokenStream) -> TokenStream { impl #i_gen aide::OperationOutput for #name #t_gen #w_gen { type Inner = <#output as aide::OperationOutput>::Inner; fn operation_response( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, operation: &mut aide::openapi::Operation ) -> Option { <#output as aide::OperationOutput>::operation_response( @@ -151,7 +151,7 @@ pub fn derive_operation_io(ts: TokenStream) -> TokenStream { ) } fn inferred_responses( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, operation: &mut aide::openapi::Operation ) -> Vec<(Option, aide::openapi::Response)> { <#output as aide::OperationOutput>::inferred_responses( diff --git a/crates/aide/CHANGELOG.md b/crates/aide/CHANGELOG.md index 562357e..29fc5fd 100644 --- a/crates/aide/CHANGELOG.md +++ b/crates/aide/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +- **breaking:** Rename `gen` module to `generate`, + because `gen` is going to be a keyword in Rust 2024 ([#174]) + +[#174]: https://github.com/tamasfe/aide/pull/174 + ## 0.13.5 - **added:** Implement `OperationHandler` for `axum::handler::Layered` ([#133]) diff --git a/crates/aide/src/axum/inputs.rs b/crates/aide/src/axum/inputs.rs index faaf216..431be84 100644 --- a/crates/aide/src/axum/inputs.rs +++ b/crates/aide/src/axum/inputs.rs @@ -41,7 +41,7 @@ impl OperationInput for axum_extra::typed_header::TypedHeader where T: axum_extra::headers::Header, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let s = ctx.schema.subschema_for::(); add_parameters( ctx, @@ -72,7 +72,7 @@ where #[cfg(any(feature = "axum-json", feature = "axum-extra-json-deserializer"))] fn operation_input_json( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) { let schema = ctx.schema.subschema_for::().into_object(); @@ -108,7 +108,7 @@ impl OperationInput for axum::Json where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { operation_input_json::(ctx, operation); } } @@ -118,7 +118,7 @@ impl OperationInput for axum_extra::extract::JsonDeserializer where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { operation_input_json::(ctx, operation); } } @@ -128,7 +128,7 @@ impl OperationInput for axum::extract::Form where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let schema = ctx.schema.subschema_for::().into_object(); let resolved_schema = ctx.resolve_schema(&schema); @@ -162,7 +162,7 @@ impl OperationInput for Path where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let schema = ctx.schema.subschema_for::().into_object(); let params = parameters_from_schema(ctx, schema, ParamLocation::Path); add_parameters(ctx, operation, params); @@ -174,7 +174,7 @@ impl OperationInput for axum::extract::Query where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let schema = ctx.schema.subschema_for::().into_object(); let params = parameters_from_schema(ctx, schema, ParamLocation::Query); add_parameters(ctx, operation, params); @@ -184,7 +184,7 @@ where #[cfg(feature = "axum-ws")] impl OperationInput for axum::extract::ws::WebSocketUpgrade { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { if operation.responses.is_none() { @@ -311,7 +311,7 @@ impl OperationInput for axum::extract::ws::WebSocketUpgrade { #[cfg(feature = "axum-multipart")] impl OperationInput for axum::extract::Multipart { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { set_body( ctx, operation, @@ -353,7 +353,7 @@ mod extra { T: OperationInput, { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { T::operation_input(ctx, operation); @@ -365,7 +365,7 @@ mod extra { T: OperationInput, { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { T::operation_input(ctx, operation); @@ -383,7 +383,7 @@ mod extra { where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let schema = ctx.schema.subschema_for::().into_object(); let resolved_schema = ctx.resolve_schema(&schema); @@ -417,7 +417,7 @@ mod extra { where T: JsonSchema, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { let schema = ctx.schema.subschema_for::().into_object(); let params = parameters_from_schema(ctx, schema, ParamLocation::Query); add_parameters(ctx, operation, params); diff --git a/crates/aide/src/axum/mod.rs b/crates/aide/src/axum/mod.rs index c591e1a..09413cf 100644 --- a/crates/aide/src/axum/mod.rs +++ b/crates/aide/src/axum/mod.rs @@ -171,7 +171,7 @@ use std::{convert::Infallible, future::Future, mem, pin::Pin}; use crate::{ - gen::{self, in_context}, + generate::{self, in_context}, openapi::{OpenApi, PathItem, ReferenceOr, SchemaObject}, operation::OperationHandler, util::merge_paths, @@ -466,7 +466,7 @@ where }); if needs_reset { - gen::reset_context(); + generate::reset_context(); } } } diff --git a/crates/aide/src/axum/outputs.rs b/crates/aide/src/axum/outputs.rs index 3d40fac..975457d 100644 --- a/crates/aide/src/axum/outputs.rs +++ b/crates/aide/src/axum/outputs.rs @@ -11,7 +11,7 @@ use schemars::schema::{InstanceType, SingleOrVec}; #[cfg(any(feature = "axum-form", feature = "axum-json"))] use schemars::JsonSchema; -use crate::{gen::GenContext, operation::OperationOutput}; +use crate::{generate::GenContext, operation::OperationOutput}; #[cfg(feature = "axum-json")] impl OperationOutput for axum::Json @@ -41,7 +41,7 @@ where } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -90,7 +90,7 @@ where } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -139,7 +139,7 @@ impl OperationOutput for Html { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -159,7 +159,7 @@ impl OperationOutput for JsonRejection { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -184,7 +184,7 @@ impl OperationOutput for FormRejection { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { diff --git a/crates/aide/src/axum/routing.rs b/crates/aide/src/axum/routing.rs index 40c916d..c439bc9 100644 --- a/crates/aide/src/axum/routing.rs +++ b/crates/aide/src/axum/routing.rs @@ -4,7 +4,7 @@ use std::{convert::Infallible, mem}; use crate::{ - gen::GenContext, + generate::GenContext, openapi::{Operation, PathItem, ReferenceOr, Response, StatusCode}, Error, }; @@ -20,7 +20,7 @@ use tower_layer::Layer; use tower_service::Service; use crate::{ - gen::in_context, + generate::in_context, operation::{OperationHandler, OperationInput, OperationOutput}, transform::TransformOperation, }; diff --git a/crates/aide/src/gen.rs b/crates/aide/src/generate.rs similarity index 100% rename from crates/aide/src/gen.rs rename to crates/aide/src/generate.rs diff --git a/crates/aide/src/helpers/use_api.rs b/crates/aide/src/helpers/use_api.rs index 9004dec..1027304 100644 --- a/crates/aide/src/helpers/use_api.rs +++ b/crates/aide/src/helpers/use_api.rs @@ -5,7 +5,7 @@ use std::{ use serde::{Deserialize, Serialize}; -use crate::gen::GenContext; +use crate::generate::GenContext; use crate::openapi::{Operation, Response}; use crate::{OperationInput, OperationOutput}; diff --git a/crates/aide/src/helpers/with_api.rs b/crates/aide/src/helpers/with_api.rs index a3efda1..961b8aa 100644 --- a/crates/aide/src/helpers/with_api.rs +++ b/crates/aide/src/helpers/with_api.rs @@ -5,7 +5,7 @@ use std::{ use serde::{Deserialize, Serialize}; -use crate::gen::GenContext; +use crate::generate::GenContext; use crate::openapi::{Operation, Response}; use crate::{OperationInput, OperationOutput}; diff --git a/crates/aide/src/impls/bytes.rs b/crates/aide/src/impls/bytes.rs index 95ccd0d..7187b04 100644 --- a/crates/aide/src/impls/bytes.rs +++ b/crates/aide/src/impls/bytes.rs @@ -9,7 +9,7 @@ use crate::{ impl OperationInput for Bytes { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { set_body( @@ -30,7 +30,7 @@ impl OperationInput for Bytes { impl OperationInput for BytesMut { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { Bytes::operation_input(ctx, operation); @@ -41,7 +41,7 @@ impl OperationOutput for Bytes { type Inner = Self; fn operation_response( - _ctx: &mut crate::gen::GenContext, + _ctx: &mut crate::generate::GenContext, _operation: &mut Operation, ) -> Option { Some(Response { @@ -55,7 +55,7 @@ impl OperationOutput for Bytes { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -70,14 +70,14 @@ impl OperationOutput for BytesMut { type Inner = Self; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { Bytes::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { Bytes::inferred_responses(ctx, operation) diff --git a/crates/aide/src/impls/mod.rs b/crates/aide/src/impls/mod.rs index 9f9a292..1a591b6 100644 --- a/crates/aide/src/impls/mod.rs +++ b/crates/aide/src/impls/mod.rs @@ -19,12 +19,12 @@ impl OperationInput for Result where T: OperationInput, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { T::operation_input(ctx, operation); } fn inferred_early_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { T::inferred_early_responses(ctx, operation) @@ -39,14 +39,14 @@ where type Inner = T; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { T::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { let mut responses = T::inferred_responses(ctx, operation); @@ -59,7 +59,7 @@ impl OperationInput for Option where T: OperationInput, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { // Make parameters proudced by T optional if T is wrapped in an Option. // TODO: we should probably do this for the body as well. let mut temp_op = Operation::default(); @@ -96,14 +96,14 @@ where type Inner = ::Inner; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { T::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { T::inferred_responses(ctx, operation) @@ -114,7 +114,7 @@ impl OperationInput for Box where T: OperationInput, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { T::operation_input(ctx, operation); } } @@ -126,14 +126,14 @@ where type Inner = ::Inner; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { T::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { T::inferred_responses(ctx, operation) @@ -144,7 +144,7 @@ impl OperationInput for Rc where T: OperationInput, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { T::operation_input(ctx, operation); } } @@ -156,14 +156,14 @@ where type Inner = ::Inner; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { T::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { T::inferred_responses(ctx, operation) @@ -174,7 +174,7 @@ impl OperationInput for Arc where T: OperationInput, { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { T::operation_input(ctx, operation); } } @@ -186,14 +186,14 @@ where type Inner = ::Inner; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { T::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { T::inferred_responses(ctx, operation) @@ -201,7 +201,7 @@ where } impl OperationInput for String { - fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) { + fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) { set_body( ctx, operation, @@ -222,7 +222,7 @@ impl OperationOutput for String { type Inner = Self; fn operation_response( - _ctx: &mut crate::gen::GenContext, + _ctx: &mut crate::generate::GenContext, _operation: &mut Operation, ) -> Option { Some(Response { @@ -236,7 +236,7 @@ impl OperationOutput for String { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -251,14 +251,14 @@ impl OperationOutput for &str { type Inner = Self; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { String::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { String::inferred_responses(ctx, operation) @@ -269,14 +269,14 @@ impl OperationOutput for Cow<'_, str> { type Inner = Self; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { String::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { String::inferred_responses(ctx, operation) @@ -287,7 +287,7 @@ impl OperationOutput for () { type Inner = Self; fn operation_response( - _ctx: &mut crate::gen::GenContext, + _ctx: &mut crate::generate::GenContext, _operation: &mut Operation, ) -> Option { Some(Response { @@ -297,7 +297,7 @@ impl OperationOutput for () { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -310,7 +310,7 @@ impl OperationOutput for () { impl OperationInput for Vec { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { set_body( @@ -333,7 +333,7 @@ impl OperationOutput for Vec { type Inner = Self; fn operation_response( - _ctx: &mut crate::gen::GenContext, + _ctx: &mut crate::generate::GenContext, _operation: &mut Operation, ) -> Option { Some(Response { @@ -347,7 +347,7 @@ impl OperationOutput for Vec { } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { if let Some(res) = Self::operation_response(ctx, operation) { @@ -360,7 +360,7 @@ impl OperationOutput for Vec { impl OperationInput for &[u8] { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { Vec::::operation_input(ctx, operation); @@ -371,14 +371,14 @@ impl OperationOutput for &[u8] { type Inner = Self; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { Vec::::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { Vec::::inferred_responses(ctx, operation) @@ -387,7 +387,7 @@ impl OperationOutput for &[u8] { impl OperationInput for Cow<'_, [u8]> { fn operation_input( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut crate::openapi::Operation, ) { Vec::::operation_input(ctx, operation); @@ -398,14 +398,14 @@ impl OperationOutput for Cow<'_, [u8]> { type Inner = Self; fn operation_response( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Option { Vec::::operation_response(ctx, operation) } fn inferred_responses( - ctx: &mut crate::gen::GenContext, + ctx: &mut crate::generate::GenContext, operation: &mut Operation, ) -> Vec<(Option, Response)> { Vec::::inferred_responses(ctx, operation) diff --git a/crates/aide/src/lib.rs b/crates/aide/src/lib.rs index 629b8a3..7ad375a 100644 --- a/crates/aide/src/lib.rs +++ b/crates/aide/src/lib.rs @@ -64,7 +64,7 @@ //! //! By default no action is taken on errors, in order to handle them //! it is possible to register an error handler in the thread-local context -//! with [`aide::gen::on_error`](crate::gen::on_error). +//! with [`aide::generate::on_error`](crate::generate::on_error). //! //! False positives are chosen over silently swallowing potential //! errors, these might happen when there is not enough contextual @@ -124,7 +124,7 @@ mod macros; mod impls; pub mod error; -pub mod gen; +pub mod generate; pub mod operation; pub mod openapi; diff --git a/crates/aide/src/operation.rs b/crates/aide/src/operation.rs index a3cef7d..1917967 100644 --- a/crates/aide/src/operation.rs +++ b/crates/aide/src/operation.rs @@ -3,7 +3,7 @@ use indexmap::IndexMap; use schemars::schema::SchemaObject; -use crate::gen::GenContext; +use crate::generate::GenContext; use crate::openapi::{ self, Operation, Parameter, ParameterData, QueryStyle, ReferenceOr, RequestBody, Response, }; diff --git a/crates/aide/src/transform.rs b/crates/aide/src/transform.rs index c939dae..7ebd080 100644 --- a/crates/aide/src/transform.rs +++ b/crates/aide/src/transform.rs @@ -49,7 +49,7 @@ use std::{any::type_name, marker::PhantomData}; use crate::{ - gen::GenContext, + generate::GenContext, openapi::{ Components, Contact, Info, License, OpenApi, Operation, Parameter, PathItem, ReferenceOr, Response, SecurityScheme, Server, StatusCode, Tag, @@ -59,7 +59,9 @@ use crate::{ use indexmap::IndexMap; use serde::Serialize; -use crate::{error::Error, gen::in_context, operation::OperationOutput, util::iter_operations_mut}; +use crate::{ + error::Error, generate::in_context, operation::OperationOutput, util::iter_operations_mut, +}; /// A transform helper that wraps [`OpenApi`]. #[must_use] diff --git a/crates/aide/src/util.rs b/crates/aide/src/util.rs index 5064a31..acca03b 100644 --- a/crates/aide/src/util.rs +++ b/crates/aide/src/util.rs @@ -2,7 +2,7 @@ //! Miscellaneous utilities. use crate::{ - gen::GenContext, + generate::GenContext, openapi::{Operation, PathItem}, Error, }; diff --git a/crates/axum-jsonschema/src/lib.rs b/crates/axum-jsonschema/src/lib.rs index 7d3e827..edac0b9 100644 --- a/crates/axum-jsonschema/src/lib.rs +++ b/crates/axum-jsonschema/src/lib.rs @@ -231,7 +231,7 @@ mod impl_aide { T: JsonSchema, { fn operation_input( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, operation: &mut aide::openapi::Operation, ) { axum::Json::::operation_input(ctx, operation); @@ -245,14 +245,14 @@ mod impl_aide { type Inner = as aide::OperationOutput>::Inner; fn operation_response( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, op: &mut aide::openapi::Operation, ) -> Option { axum::Json::::operation_response(ctx, op) } fn inferred_responses( - ctx: &mut aide::gen::GenContext, + ctx: &mut aide::generate::GenContext, operation: &mut aide::openapi::Operation, ) -> Vec<(Option, aide::openapi::Response)> { axum::Json::::inferred_responses(ctx, operation) diff --git a/examples/example-axum-worker/src/docs.rs b/examples/example-axum-worker/src/docs.rs index 2cfdf1a..e8bbc6c 100644 --- a/examples/example-axum-worker/src/docs.rs +++ b/examples/example-axum-worker/src/docs.rs @@ -20,7 +20,7 @@ pub fn docs_routes(state: AppState) -> ApiRouter { // As a result, the `serve_redoc` route will // have the `text/html` content-type correctly set // with a 200 status. - aide::gen::infer_responses(true); + aide::generate::infer_responses(true); let router: ApiRouter = ApiRouter::new() .api_route_with( @@ -58,7 +58,7 @@ pub fn docs_routes(state: AppState) -> ApiRouter { // Afterwards we disable response inference because // it might be incorrect for other routes. - aide::gen::infer_responses(false); + aide::generate::infer_responses(false); router } diff --git a/examples/example-axum-worker/src/lib.rs b/examples/example-axum-worker/src/lib.rs index 19f0a41..73caace 100644 --- a/examples/example-axum-worker/src/lib.rs +++ b/examples/example-axum-worker/src/lib.rs @@ -33,11 +33,11 @@ async fn fetch( _ctx: Context, ) -> worker::Result> { console_error_panic_hook::set_once(); - aide::gen::on_error(|error| { + aide::generate::on_error(|error| { println!("{error}"); }); - aide::gen::extract_schemas(true); + aide::generate::extract_schemas(true); let state = AppState::default(); diff --git a/examples/example-axum/src/docs.rs b/examples/example-axum/src/docs.rs index 2cfdf1a..e8bbc6c 100644 --- a/examples/example-axum/src/docs.rs +++ b/examples/example-axum/src/docs.rs @@ -20,7 +20,7 @@ pub fn docs_routes(state: AppState) -> ApiRouter { // As a result, the `serve_redoc` route will // have the `text/html` content-type correctly set // with a 200 status. - aide::gen::infer_responses(true); + aide::generate::infer_responses(true); let router: ApiRouter = ApiRouter::new() .api_route_with( @@ -58,7 +58,7 @@ pub fn docs_routes(state: AppState) -> ApiRouter { // Afterwards we disable response inference because // it might be incorrect for other routes. - aide::gen::infer_responses(false); + aide::generate::infer_responses(false); router } diff --git a/examples/example-axum/src/main.rs b/examples/example-axum/src/main.rs index ac4f621..9eda503 100644 --- a/examples/example-axum/src/main.rs +++ b/examples/example-axum/src/main.rs @@ -22,11 +22,11 @@ pub mod todos; #[tokio::main] async fn main() { - aide::gen::on_error(|error| { + aide::generate::on_error(|error| { println!("{error}"); }); - aide::gen::extract_schemas(true); + aide::generate::extract_schemas(true); let state = AppState::default();