#[non_exhaustive]pub enum SchemaOrRef {
Ref {
ref_path: String,
},
Schema(Box<Schema>),
}Expand description
Adapter: convert sekkei’s flat Schema (with optional ref_path) to the
SchemaOrRef enum pattern used by openapi-forge consumers.
This preserves API compatibility for code that pattern-matches on
SchemaOrRef::Ref vs SchemaOrRef::Schema.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl SchemaOrRef
impl SchemaOrRef
Sourcepub fn ref_name(&self) -> Option<&str>
pub fn ref_name(&self) -> Option<&str>
Extract the schema name from a $ref like #/components/schemas/Foo.
Sourcepub fn from_schema(schema: &Schema) -> Self
👎Deprecated since 0.2.0: use SchemaOrRef::from(schema) instead
pub fn from_schema(schema: &Schema) -> Self
use SchemaOrRef::from(schema) instead
Convert from a sekkei Schema.
If the schema has a ref_path, it becomes SchemaOrRef::Ref;
otherwise it becomes SchemaOrRef::Schema.
Trait Implementations§
Source§impl Clone for SchemaOrRef
impl Clone for SchemaOrRef
Source§impl Debug for SchemaOrRef
impl Debug for SchemaOrRef
Auto Trait Implementations§
impl Freeze for SchemaOrRef
impl RefUnwindSafe for SchemaOrRef
impl Send for SchemaOrRef
impl Sync for SchemaOrRef
impl Unpin for SchemaOrRef
impl UnsafeUnpin for SchemaOrRef
impl UnwindSafe for SchemaOrRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more