api-macro: error on unexpected keys

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-04-14 13:29:43 +02:00
parent 2c83d55cb0
commit 19ad65ac84

View File

@ -45,6 +45,14 @@ pub fn handle_method(mut attribs: JSONObject, mut func: syn::ItemFn) -> Result<T
.transpose()?
.unwrap_or(false);
if !attribs.is_empty() {
bail!(
attribs.span(),
"unexpected api elements: {}",
util::join_debug(", ", attribs.elements.keys()),
);
}
let (doc_comment, doc_span) = util::get_doc_comments(&func.attrs)?;
util::derive_descriptions(
&mut input_schema,