api macro: assume that field types are api types by default

#[api]
    struct Foo {
        field: Bar,
    }

does not require the use of
    #[api(
        properties: {
            field: {
                type: Bar,
            },
        },
    )]

anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-08-03 13:31:44 +02:00
parent 8ebcd68a2c
commit 017b81712e

View File

@ -496,7 +496,12 @@ pub fn infer_type(schema: &mut Schema, ty: &syn::Type) -> Result<bool, syn::Erro
} else if api::NUMBERNAMES.iter().any(|n| path.path.is_ident(n)) {
schema.item = SchemaItem::Number(ty.span());
} else {
bail!(ty => "cannot infer parameter type from this rust type");
// bail!(ty => "cannot infer parameter type from this rust type");
schema.item = SchemaItem::ExternType(syn::ExprPath {
attrs: Vec::new(),
qself: path.qself.clone(),
path: path.path.clone(),
});
}
}
_ => (),