Respect with attributes on enum variants

This commit is contained in:
Graham Esau 2020-05-10 17:17:04 +01:00
parent 1e17c46803
commit 08886799bb
8 changed files with 161 additions and 25 deletions

View file

@ -7,9 +7,8 @@ pub use schemars_to_serde::process_serde_attrs;
use proc_macro2::{Group, Span, TokenStream, TokenTree};
use syn::parse::{self, Parse};
pub fn get_with_from_attrs(field: &syn::Field) -> Option<syn::Result<syn::Type>> {
field
.attrs
pub fn get_with_from_attrs(attrs: &[syn::Attribute]) -> Option<syn::Result<syn::Type>> {
attrs
.iter()
.filter(|at| match at.path.get_ident() {
// FIXME this is relying on order of attributes (schemars before serde) from schemars_to_serde.rs