1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-06-07 06:10:42 +00:00

add derive macro for resource

This commit is contained in:
Dominic 2019-10-06 15:03:30 +02:00
parent 75c399d97a
commit 0cf7c9aa3a
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
9 changed files with 132 additions and 15 deletions

View file

@ -21,6 +21,7 @@ failure = "0.1"
futures = "0.1"
gotham = "0.4"
gotham_derive = "0.4"
gotham_restful_derive = { path = "../gotham_restful_derive" }
hyper = "0.12"
indexmap = { version = "1.0", optional = true }
log = { version = "0.4", optional = true }
@ -30,5 +31,5 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
[features]
default = ["openapi", "chrono"]
openapi = ["indexmap", "log", "openapiv3"]
default = []
openapi = ["gotham_restful_derive/openapi", "indexmap", "log", "openapiv3"]

View file

@ -4,6 +4,17 @@
pub use hyper::StatusCode;
use serde::{de::DeserializeOwned, Serialize};
pub use gotham_restful_derive::*;
/// Not public API
#[doc(hidden)]
pub mod export
{
#[cfg(feature = "openapi")]
pub use indexmap::IndexMap;
#[cfg(feature = "openapi")]
pub use openapiv3;
}
pub mod helper;
#[cfg(feature = "openapi")]

View file

@ -5,8 +5,10 @@ use chrono::{
use indexmap::IndexMap;
use openapiv3::{
ArrayType, IntegerType, NumberType, ObjectType, ReferenceOr::Item, ReferenceOr::Reference, Schema,
SchemaData, SchemaKind, StringFormat, StringType, Type, VariantOrUnknownOrEmpty
SchemaData, SchemaKind, StringType, Type
};
#[cfg(feature = "chrono")]
use openapiv3::{StringFormat, VariantOrUnknownOrEmpty};
#[derive(Debug, Clone, PartialEq)]
pub struct OpenapiSchema