1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-23 04:52:28 +00:00

finally get rid of the helper

This commit is contained in:
Dominic 2019-10-13 23:19:34 +02:00
parent 81988c4ef0
commit 286466fcc9
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
3 changed files with 4 additions and 28 deletions

View file

@ -1,23 +0,0 @@
#[cfg(feature = "openapi")]
pub mod openapi
{
pub use indexmap::IndexMap;
pub use openapiv3::{ObjectType, ReferenceOr, Schema, SchemaData, SchemaKind, StringType, Type, VariantOrUnknownOrEmpty};
}
#[macro_export]
macro_rules! rest_resource {
($res_name:ident, $route:ident => $setup:block) => {
pub struct $res_name;
impl ::gotham_restful::Resource for $res_name
{
fn name() -> String
{
stringify!($res_name).to_string()
}
fn setup<D : ::gotham_restful::DrawResourceRoutes>(mut $route : D) $setup
}
}
}

View file

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

View file

@ -48,7 +48,7 @@ fn expand_enum(input : ItemEnum) -> TokenStream2
{ {
fn to_schema() -> ::gotham_restful::OpenapiSchema fn to_schema() -> ::gotham_restful::OpenapiSchema
{ {
use ::gotham_restful::{helper::openapi::*, OpenapiSchema}; use ::gotham_restful::{export::openapi::*, OpenapiSchema};
let mut enumeration : Vec<String> = Vec::new(); let mut enumeration : Vec<String> = Vec::new();
@ -130,7 +130,7 @@ pub fn expand_struct(input : ItemStruct) -> TokenStream2
{ {
fn to_schema() -> ::gotham_restful::OpenapiSchema fn to_schema() -> ::gotham_restful::OpenapiSchema
{ {
use ::gotham_restful::{helper::openapi::*, OpenapiSchema}; use ::gotham_restful::{export::{openapi::*, IndexMap}, OpenapiSchema};
let mut properties : IndexMap<String, ReferenceOr<Box<Schema>>> = IndexMap::new(); let mut properties : IndexMap<String, ReferenceOr<Box<Schema>>> = IndexMap::new();
let mut required : Vec<String> = Vec::new(); let mut required : Vec<String> = Vec::new();