1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
pub mod macros; pub mod models; pub use macros::*; pub use models::*; pub use opg_derive::OpgModel; pub const OPENAPI_VERSION: &'static str = "3.0.3"; pub const SCHEMA_REFERENCE_PREFIX: &'static str = "#/components/schemas/"; impl_opg_model!(String => string always_inline); impl_opg_model!(i8 => integer always_inline); impl_opg_model!(u8 => integer always_inline); impl_opg_model!(i16 => integer always_inline); impl_opg_model!(u16 => integer always_inline); impl_opg_model!(i32 => integer always_inline); impl_opg_model!(u32 => integer always_inline); impl_opg_model!(i64 => integer always_inline); impl_opg_model!(u64 => integer always_inline); impl_opg_model!(f32 => number always_inline); impl_opg_model!(f64 => number always_inline); impl_opg_model!(bool => boolean always_inline); #[cfg(feature = "uuid")] impl OpgModel for uuid::Uuid { fn get_structure() -> Model { Model { description: Some(format!( "UUID ver. 4 [rfc](https://tools.ietf.org/html/rfc4122)" )), data: ModelData::Single(ModelTypeDescription::String(ModelString { variants: None, data: ModelSimple { format: Some(format!("uuid")), example: Some(format!("00000000-0000-0000-0000-000000000000")), }, })), } } } impl<T> OpgModel for Vec<T> where T: OpgModel, { fn get_structure() -> Model { Model { description: None, data: ModelData::Single(ModelTypeDescription::Array(ModelArray { items: Box::new(ModelReference::Inline(T::get_structure())), })), } } }