api-marcro: throw compiler error if description for enums is empty
A description is required for the API schema types and we fallback to the rust doc-comment when no explicit one is set. But a empty string was returned if no doc-comment existed, so check for the comment to be non-empty and throw a compile-time error otherwise. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
1c4467841d
commit
ba3ee7a4db
@ -74,6 +74,12 @@ fn handle_string_enum(
|
||||
|
||||
if schema.description.is_none() {
|
||||
let (comment, span) = util::get_doc_comments(&enum_ty.attrs)?;
|
||||
if comment.is_empty() {
|
||||
error!(
|
||||
Span::call_site(),
|
||||
"missing doc comment on enum for api-schema description"
|
||||
);
|
||||
}
|
||||
schema.description = Maybe::Derived(syn::LitStr::new(comment.trim(), span));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user