Struct-like enum variants work!
This commit is contained in:
parent
8b034f4dd8
commit
d90a29f3f8
1 changed files with 3 additions and 2 deletions
|
@ -86,6 +86,7 @@ fn schema_for_enum(variants: &[Variant]) -> TokenStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
schemas.extend(complex_variants.into_iter().map(|variant| {
|
schemas.extend(complex_variants.into_iter().map(|variant| {
|
||||||
|
let name = variant.attrs.name().deserialize_name();
|
||||||
let sub_schema = match variant.style {
|
let sub_schema = match variant.style {
|
||||||
Style::Newtype => {
|
Style::Newtype => {
|
||||||
let f = &variant.fields[0];
|
let f = &variant.fields[0];
|
||||||
|
@ -100,10 +101,10 @@ fn schema_for_enum(variants: &[Variant]) -> TokenStream {
|
||||||
gen.subschema_for::<(#(#types),*)>()
|
gen.subschema_for::<(#(#types),*)>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Style::Struct => unimplemented!("work in progress!"),
|
Style::Struct => schema_for_struct(&variant.fields),
|
||||||
Style::Unit => unreachable!("Unit variants already filtered out"),
|
Style::Unit => unreachable!("Unit variants already filtered out"),
|
||||||
};
|
};
|
||||||
let name = variant.attrs.name().deserialize_name();
|
|
||||||
wrap_schema_fields(quote! {
|
wrap_schema_fields(quote! {
|
||||||
properties: {
|
properties: {
|
||||||
let mut props = std::collections::BTreeMap::new();
|
let mut props = std::collections::BTreeMap::new();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue