#[cfg(feature = "actix-base")]
mod actix;
mod extensions;
pub mod models;
#[cfg(feature = "codegen")]
mod resolver;
pub mod schema;
#[cfg(feature = "actix-base")]
pub use self::actix::{
AcceptedJson, CreatedJson, NoContent, OperationModifier, ResponderWrapper, ResponseWrapper,
};
#[cfg(feature = "actix4")]
pub use self::actix::HttpResponseWrapper;
pub use self::{
models::{DefaultSchema, ResolvableApi},
schema::Schema,
};
pub use paperclip_macros::*;
pub use serde_json;
#[cfg(feature = "codegen")]
pub(crate) use self::resolver::Resolver;
#[cfg(feature = "codegen")]
pub(crate) use crate::error::ValidationError;
#[cfg(feature = "codegen")]
impl<S: Schema + Default> ResolvableApi<S> {
pub fn resolve(self) -> Result<ResolvableApi<S>, ValidationError> {
let mut resolver = Resolver::from((
self.definitions,
self.paths,
self.parameters,
self.responses,
));
resolver.resolve()?;
Ok(ResolvableApi {
swagger: self.swagger,
info: self.info,
definitions: resolver.defs,
paths: resolver.paths,
base_path: self.base_path,
host: self.host,
schemes: self.schemes,
consumes: self.consumes,
produces: self.produces,
coders: self.coders,
support_crates: self.support_crates,
parameters: resolver.params,
responses: resolver.resp,
spec_format: self.spec_format,
external_docs: self.external_docs,
security: self.security,
security_definitions: self.security_definitions,
tags: self.tags,
extensions: self.extensions,
})
}
}