mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-04-20 06:54:46 +00:00
Allow OpenAPI customizations
This commit is contained in:
parent
75d2a8f557
commit
810680d9b1
6 changed files with 198 additions and 34 deletions
|
@ -31,6 +31,7 @@ pub fn expand_resource(tokens : TokenStream) -> TokenStream
|
|||
let krate = super::krate();
|
||||
let input = parse_macro_input!(tokens as ItemStruct);
|
||||
let ident = input.ident;
|
||||
let name = ident.to_string();
|
||||
|
||||
let methods : Vec<TokenStream2> = input.attrs.into_iter().filter(|attr|
|
||||
attr.path.segments.iter().last().map(|segment| segment.ident.to_string()) == Some("rest_resource".to_string()) // TODO wtf
|
||||
|
@ -39,8 +40,8 @@ pub fn expand_resource(tokens : TokenStream) -> TokenStream
|
|||
m.0.into_iter()
|
||||
}).map(|method| {
|
||||
let method = Method::from_str(&method.to_string()).expect("unknown method");
|
||||
let mod_ident = method.mod_ident(ident.to_string());
|
||||
let ident = method.setup_ident(ident.to_string());
|
||||
let mod_ident = method.mod_ident(&name);
|
||||
let ident = method.setup_ident(&name);
|
||||
quote!(#mod_ident::#ident(&mut route);)
|
||||
}).collect();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue