@@ -35,7 +35,7 @@ impl GqlObject {
3535 let mut item = GqlObject :: new ( obj. name . into ( ) , description) ;
3636 item. fields
3737 . extend ( obj. fields . iter ( ) . map ( |f| GqlObjectField {
38- description : None ,
38+ description : f . description . clone ( ) ,
3939 name : f. name . clone ( ) ,
4040 type_ : FieldType :: from ( f. field_type . clone ( ) ) ,
4141 } ) ) ;
@@ -50,7 +50,7 @@ impl GqlObject {
5050 ) ;
5151 let fields = obj. fields . clone ( ) . unwrap ( ) . into_iter ( ) . filter_map ( |t| {
5252 t. map ( |t| GqlObjectField {
53- description : None ,
53+ description : t . description . clone ( ) ,
5454 name : t. name . expect ( "field name" ) ,
5555 type_ : FieldType :: from ( t. type_ . expect ( "field type" ) ) ,
5656 } )
@@ -70,11 +70,13 @@ impl GqlObject {
7070 let name = Ident :: new ( prefix, Span :: call_site ( ) ) ;
7171 let fields = self . response_fields_for_selection ( query_context, selection, prefix) ?;
7272 let field_impls = self . field_impls_for_selection ( query_context, selection, & prefix) ?;
73+ let description = self . description . as_ref ( ) . map ( |desc| quote ! ( #[ doc = #desc] ) ) ;
7374 Ok ( quote ! {
7475 #( #field_impls) *
7576
7677 #[ derive( Debug , Serialize , Deserialize ) ]
7778 #[ serde( rename_all = "camelCase" ) ]
79+ #description
7880 pub struct #name {
7981 #( #fields, ) *
8082 }
0 commit comments