[][src]Struct paperclip::v2::models::Api

pub struct Api<P, R, S> {
    pub swagger: Version,
    pub definitions: BTreeMap<String, S>,
    pub paths: BTreeMap<String, PathItem<P, R>>,
    pub host: Option<String>,
    pub base_path: Option<String>,
    pub consumes: BTreeSet<MediaRange>,
    pub produces: BTreeSet<MediaRange>,
    pub schemes: BTreeSet<OperationProtocol>,
    pub parameters: BTreeMap<String, P>,
    pub responses: BTreeMap<String, R>,
    pub security_definitions: BTreeMap<String, SecurityScheme>,
    pub security: Vec<BTreeMap<String, Vec<String>>>,
    pub tags: Vec<Tag>,
    pub external_docs: Option<ExternalDocs>,
    pub coders: Coders,
    pub support_crates: BTreeMap<String, String>,
    pub spec_format: SpecFormat,
    pub info: Info,
}

OpenAPI v2 (swagger) spec generic over parameter and schema.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object

Fields

swagger: Versiondefinitions: BTreeMap<String, S>paths: BTreeMap<String, PathItem<P, R>>host: Option<String>base_path: Option<String>consumes: BTreeSet<MediaRange>produces: BTreeSet<MediaRange>schemes: BTreeSet<OperationProtocol>parameters: BTreeMap<String, P>responses: BTreeMap<String, R>security_definitions: BTreeMap<String, SecurityScheme>security: Vec<BTreeMap<String, Vec<String>>>tags: Vec<Tag>external_docs: Option<ExternalDocs>coders: Coderssupport_crates: BTreeMap<String, String>

Additional crates that need to be added to the manifest.

The key is the LHS of a dependency, which is the crate name. The value is the RHS of a crate's requirements as it would appear in the manifest. Note that the caller must add proper quoting whenever required.

For example, in a JSON spec, the following are all valid:

spec_format: SpecFormat

This field is set manually, because we don't know the format in which the spec was provided and we need to use this as the fallback encoding.

info: Info

Methods

impl<P, R, S> Api<P, R, S>[src]

pub fn path_parameters_map(
    path: &str,
    f: impl FnMut(&str) -> Cow<'static, str>
) -> Cow<str>
[src]

Gets the parameters from the given path template and calls the given function with the parameter names.

impl<S> Api<ArcRwLock<Parameter<Resolvable<S>>>, ArcRwLock<Response<Resolvable<S>>>, Resolvable<S>> where
    S: Schema + Default
[src]

pub fn resolve(
    self
) -> Result<Api<ArcRwLock<Parameter<Resolvable<S>>>, ArcRwLock<Response<Resolvable<S>>>, Resolvable<S>>, ValidationError>
[src]

Consumes this API schema, resolves the references and returns the resolved schema.

This walks recursively, collects the referenced schema objects, substitutes the referenced IDs with the pointer to schema objects and returns the resolved object or an error if it encountered one.

Trait Implementations

impl<P, R, S> Clone for Api<P, R, S> where
    P: Clone,
    R: Clone,
    S: Clone
[src]

impl<P, R, S> Debug for Api<P, R, S> where
    P: Debug,
    R: Debug,
    S: Debug
[src]

impl<P, R, S> Default for Api<P, R, S> where
    P: Default,
    R: Default,
    S: Default
[src]

impl<'de, P, R, S> Deserialize<'de> for Api<P, R, S> where
    P: Deserialize<'de>,
    R: Deserialize<'de>,
    S: Deserialize<'de>, 
[src]

impl<P, R, S> Serialize for Api<P, R, S> where
    P: Serialize,
    R: Serialize,
    S: Serialize
[src]

Auto Trait Implementations

impl<P, R, S> RefUnwindSafe for Api<P, R, S> where
    P: RefUnwindSafe,
    R: RefUnwindSafe,
    S: RefUnwindSafe

impl<P, R, S> Send for Api<P, R, S> where
    P: Send,
    R: Send,
    S: Send

impl<P, R, S> Sync for Api<P, R, S> where
    P: Sync,
    R: Sync,
    S: Sync

impl<P, R, S> Unpin for Api<P, R, S> where
    P: Unpin,
    R: Unpin,
    S: Unpin

impl<P, R, S> UnwindSafe for Api<P, R, S> where
    P: RefUnwindSafe + UnwindSafe,
    R: RefUnwindSafe + UnwindSafe,
    S: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,