1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-04-20 06:54:46 +00:00

add request bodies to openapi

This commit is contained in:
Dominic 2019-10-01 00:49:13 +02:00
parent 389740cd64
commit fe6a79008e
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
6 changed files with 45 additions and 29 deletions

View file

@ -2,8 +2,7 @@
#[macro_use] extern crate serde;
pub use hyper::StatusCode;
#[cfg(not(feature = "openapi"))]
use serde::Serialize;
use serde::{de::DeserializeOwned, Serialize};
pub mod helper;
@ -40,12 +39,12 @@ pub use routing::WithOpenapi;
/// that is serializable with serde, however, it is recommended to use the rest_struct!
/// macro to create one.
#[cfg(not(feature = "openapi"))]
pub trait ResourceType : Serialize
pub trait ResourceType : DeserializeOwned + Serialize
{
}
#[cfg(not(feature = "openapi"))]
impl<T : Serialize> ResourceType for T
impl<T : DeserializeOwned + Serialize> ResourceType for T
{
}
@ -53,11 +52,11 @@ impl<T : Serialize> ResourceType for T
/// that is serializable with serde, however, it is recommended to use the rest_struct!
/// macro to create one.
#[cfg(feature = "openapi")]
pub trait ResourceType : OpenapiType
pub trait ResourceType : OpenapiType + DeserializeOwned + Serialize
{
}
#[cfg(feature = "openapi")]
impl<T : OpenapiType> ResourceType for T
impl<T : OpenapiType + DeserializeOwned + Serialize> ResourceType for T
{
}