Parse doc comments on node parameters (#2163)

Parse doc comments from node arguments

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert 2024-12-28 13:15:49 +01:00 committed by GitHub
parent 6c3c2e8529
commit 1639a2afba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 0 deletions

View file

@ -59,6 +59,13 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
})
.collect();
let input_descriptions: Vec<_> = fields
.iter()
.map(|field| match field {
ParsedField::Regular { description, .. } | ParsedField::Node { description, .. } => description,
})
.collect();
let struct_fields = field_names.iter().zip(struct_generics.iter()).map(|(name, gen)| {
quote! { pub(super) #name: #gen }
});
@ -263,6 +270,7 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
#(
FieldMetadata {
name: #input_names,
description: #input_descriptions,
exposed: #exposed,
value_source: #value_sources,
number_min: #number_min_values,