pub struct VldJson<T>(pub T);Available on crate feature
poem-openapi only.Expand description
A JSON request body validated with vld: 422 with every issue on failure. See the module docs.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<'a, T: Type + VldParse> ApiExtractor<'a> for VldJson<T>
impl<'a, T: Type + VldParse> ApiExtractor<'a> for VldJson<T>
Source§const TYPES: &'static [ApiExtractorType]
const TYPES: &'static [ApiExtractorType]
The type of API extractor.
Source§type ParamRawType = ()
type ParamRawType = ()
The raw parameter type for validators.
Source§fn request_meta() -> Option<MetaRequest>
fn request_meta() -> Option<MetaRequest>
Returns
MetaRequest if this extractor is request object.Source§async fn from_request(
request: &'a Request,
body: &mut RequestBody,
_param_opts: ExtractParamOptions<Self::ParamType>,
) -> Result<Self>
async fn from_request( request: &'a Request, body: &mut RequestBody, _param_opts: ExtractParamOptions<Self::ParamType>, ) -> Result<Self>
Parse from the HTTP request.
Source§const PARAM_IS_REQUIRED: bool = false
const PARAM_IS_REQUIRED: bool = false
If it is
true, it means that this parameter is required.Source§fn security_schemes() -> Vec<&'static str>
fn security_schemes() -> Vec<&'static str>
Returns names of security scheme if this extractor is security scheme.
Source§fn has_security_fallback() -> bool
fn has_security_fallback() -> bool
Returns
true if the extractor is a security scheme with a fallback.Source§fn param_in() -> Option<MetaParamIn>
fn param_in() -> Option<MetaParamIn>
Returns the location of the parameter if this extractor is parameter.
Source§fn param_schema_ref() -> Option<MetaSchemaRef>
fn param_schema_ref() -> Option<MetaSchemaRef>
Returns the schema of the parameter if this extractor is parameter.
Source§fn param_raw_type(&self) -> Option<&Self::ParamRawType>
fn param_raw_type(&self) -> Option<&Self::ParamRawType>
Returns a reference to the raw type of this parameter.
Source§impl<T: Type + Serialize> ApiResponse for VldJson<T>
impl<T: Type + Serialize> ApiResponse for VldJson<T>
Source§fn register(registry: &mut Registry)
fn register(registry: &mut Registry)
Register the schema contained in this response object to the registry.
Source§const BAD_REQUEST_HANDLER: bool = false
const BAD_REQUEST_HANDLER: bool = false
If true, it means that the response object has a custom bad request
handler.
Source§fn from_parse_request_error(err: Error) -> Self
fn from_parse_request_error(err: Error) -> Self
Convert
poem::Error to this response object.Source§impl<T: Serialize + Send> IntoResponse for VldJson<T>
impl<T: Serialize + Send> IntoResponse for VldJson<T>
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Consume itself and return
Response.Source§fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
Wrap an
impl IntoResponse to add a header. Read moreSource§fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
Wrap an
impl IntoResponse to with a new content type. Read moreSource§fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
Wrap an
impl IntoResponse to set a status code. Read moreSource§impl<T: Type + VldParse> ParsePayload for VldJson<T>
impl<T: Type + VldParse> ParsePayload for VldJson<T>
Source§const IS_REQUIRED: bool = true
const IS_REQUIRED: bool = true
If it is
true, it means that this payload is required.Source§async fn from_request(request: &Request, body: &mut RequestBody) -> Result<Self>
async fn from_request(request: &Request, body: &mut RequestBody) -> Result<Self>
Parse the payload object from the HTTP request.
Source§impl<T: Type> Payload for VldJson<T>
impl<T: Type> Payload for VldJson<T>
Source§const CONTENT_TYPE: &'static str = "application/json; charset=utf-8"
const CONTENT_TYPE: &'static str = "application/json; charset=utf-8"
The content type of this payload.
Source§fn check_content_type(content_type: &str) -> bool
fn check_content_type(content_type: &str) -> bool
Check the content type of incoming request
Source§fn schema_ref() -> MetaSchemaRef
fn schema_ref() -> MetaSchemaRef
Gets schema reference of this payload.
impl<T: PartialEq> StructuralPartialEq for VldJson<T>
Auto Trait Implementations§
impl<T> Forget for VldJson<T>
impl<T> Freeze for VldJson<T>where
T: Freeze,
impl<T> Move for VldJson<T>
impl<T> RefUnwindSafe for VldJson<T>where
T: RefUnwindSafe,
impl<T> Send for VldJson<T>where
T: Send,
impl<T> Sync for VldJson<T>where
T: Sync,
impl<T> Unpin for VldJson<T>where
T: Unpin,
impl<T> UnsafeUnpin for VldJson<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for VldJson<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for Twhere
T: IntoResponse,
impl<T> IntoResult<T> for Twhere
T: IntoResponse,
Source§fn into_result(self) -> Result<T, Error>
fn into_result(self) -> Result<T, Error>
Consumes this value returns a
poem::Result<T>.