mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
no need to use stringify! in a proc macro
This commit is contained in:
parent
b9002bd70d
commit
40c90e6b4a
1 changed files with 3 additions and 1 deletions
|
@ -16,6 +16,7 @@ use syn::{
|
||||||
Generics,
|
Generics,
|
||||||
GenericParam,
|
GenericParam,
|
||||||
Lit,
|
Lit,
|
||||||
|
LitStr,
|
||||||
Meta,
|
Meta,
|
||||||
NestedMeta,
|
NestedMeta,
|
||||||
Result,
|
Result,
|
||||||
|
@ -175,6 +176,7 @@ fn expand_field(field : &Field) -> Result<TokenStream>
|
||||||
Some(ident) => ident,
|
Some(ident) => ident,
|
||||||
None => return Err(Error::new(field.span(), "#[derive(OpenapiType)] does not support fields without an ident"))
|
None => return Err(Error::new(field.span(), "#[derive(OpenapiType)] does not support fields without an ident"))
|
||||||
};
|
};
|
||||||
|
let ident_str = LitStr::new(&ident.to_string(), ident.span());
|
||||||
let ty = &field.ty;
|
let ty = &field.ty;
|
||||||
|
|
||||||
let attrs = parse_attributes(&field.attrs)?;
|
let attrs = parse_attributes(&field.attrs)?;
|
||||||
|
@ -193,7 +195,7 @@ fn expand_field(field : &Field) -> Result<TokenStream>
|
||||||
}
|
}
|
||||||
else if !#nullable
|
else if !#nullable
|
||||||
{
|
{
|
||||||
required.push(stringify!(#ident).to_string());
|
required.push(#ident_str.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys : Vec<String> = schema.dependencies.keys().map(|k| k.to_string()).collect();
|
let keys : Vec<String> = schema.dependencies.keys().map(|k| k.to_string()).collect();
|
||||||
|
|
Loading…
Add table
Reference in a new issue