paperclip_core::v2::schema

Trait Apiv2Schema

source
pub trait Apiv2Schema {
    // Provided methods
    fn name() -> Option<String> { ... }
    fn description() -> &'static str { ... }
    fn required() -> bool { ... }
    fn raw_schema() -> DefaultSchemaRaw { ... }
    fn schema_with_ref() -> DefaultSchemaRaw { ... }
    fn security_scheme() -> Option<SecurityScheme> { ... }
    fn header_parameter_schema() -> Vec<Parameter<DefaultSchemaRaw>> { ... }
}
Expand description

Represents a OpenAPI v2 schema object convertible. This is auto-implemented by framework-specific macros:

This is implemented for primitive types by default.

Provided Methods§

source

fn name() -> Option<String>

Name of this schema. This is the name to which the definition of the object is mapped.

source

fn description() -> &'static str

Description of this schema. In case the trait is derived, uses the documentation on the type.

source

fn required() -> bool

Indicates the requirement of this schema.

source

fn raw_schema() -> DefaultSchemaRaw

Returns the raw schema for this object.

source

fn schema_with_ref() -> DefaultSchemaRaw

Returns the schema with a reference (if this is an object).

Here, we set the global reference to this object using its name, and we either remove the reference (remove_refs) or remove all properties other than the reference (retain_ref) based on where we’re storing this object in the spec i.e., in an operation/response or in the map of definitions.

And we do that because at the time of this writing, statically collecting all models for all operations involved a lot of work, and so I went for runtime collection. Even though this happens at runtime, we’re only doing this once at the start of the application, so it won’t affect the incoming requests at all.

source

fn security_scheme() -> Option<SecurityScheme>

Returns the security scheme for this object.

source

fn header_parameter_schema() -> Vec<Parameter<DefaultSchemaRaw>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl Apiv2Schema for Value

source§

impl Apiv2Schema for Value

source§

impl Apiv2Schema for ()

source§

impl Apiv2Schema for Bytes

source§

impl Apiv2Schema for HttpRequest

source§

impl Apiv2Schema for HttpResponse

source§

impl Apiv2Schema for Payload

source§

impl Apiv2Schema for Response<BoxBody>

source§

impl<'a, T: Apiv2Schema> Apiv2Schema for &'a [T]

source§

impl<A: Apiv2Schema> Apiv2Schema for Path<(A,)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema> Apiv2Schema for Path<(A, B)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema> Apiv2Schema for Path<(A, B, C)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema, I: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H, I)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema, I: Apiv2Schema, J: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H, I, J)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema, I: Apiv2Schema, J: Apiv2Schema, K: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H, I, J, K)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema, I: Apiv2Schema, J: Apiv2Schema, K: Apiv2Schema, L: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H, I, J, K, L)>

source§

impl<A: Apiv2Schema, B: Apiv2Schema, C: Apiv2Schema, D: Apiv2Schema, E: Apiv2Schema, F: Apiv2Schema, G: Apiv2Schema, H: Apiv2Schema, I: Apiv2Schema, J: Apiv2Schema, K: Apiv2Schema, L: Apiv2Schema, M: Apiv2Schema> Apiv2Schema for Path<(A, B, C, D, E, F, G, H, I, J, K, L, M)>

source§

impl<K: ToString, V: Apiv2Schema> Apiv2Schema for BTreeMap<K, V>

source§

impl<K: ToString, V: Apiv2Schema> Apiv2Schema for HashMap<K, V>

source§

impl<T> Apiv2Schema for Data<T>

source§

impl<T: Clone> Apiv2Schema for ReqData<T>

source§

impl<T: Apiv2Schema + Clone> Apiv2Schema for Cow<'_, T>

source§

impl<T: Apiv2Schema> Apiv2Schema for Option<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for BinaryHeap<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for BTreeSet<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for LinkedList<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for VecDeque<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for Vec<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for HashSet<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for Form<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for Json<T>

JSON needs specialization because it updates the global definitions.

source§

impl<T: Apiv2Schema> Apiv2Schema for Path<T>

source§

impl<T: Apiv2Schema> Apiv2Schema for Query<T>

source§

impl<T: Apiv2Schema, E> Apiv2Schema for Result<T, E>

source§

impl<T: Apiv2Schema, const N: usize> Apiv2Schema for [T; N]

Implementors§