File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,16 @@ use unions::union_variants;
10
10
11
11
#[ derive( Debug , PartialEq ) ]
12
12
pub struct GqlInterface {
13
+ pub description : Option < String > ,
13
14
pub implemented_by : HashSet < String > ,
14
15
pub name : String ,
15
16
pub fields : Vec < GqlObjectField > ,
16
17
}
17
18
18
19
impl GqlInterface {
19
- pub fn new ( name : Cow < str > ) -> GqlInterface {
20
+ pub fn new ( name : Cow < str > , description : Option < & str > ) -> GqlInterface {
20
21
GqlInterface {
22
+ description : description. map ( |d| d. to_owned ( ) ) ,
21
23
name : name. into_owned ( ) ,
22
24
implemented_by : HashSet :: new ( ) ,
23
25
fields : vec ! [ ] ,
Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ impl ::std::convert::From<graphql_parser::schema::Document> for Schema {
279
279
schema. unions . insert ( union. name , GqlUnion ( tys) ) ;
280
280
}
281
281
schema:: TypeDefinition :: Interface ( interface) => {
282
- let mut iface = GqlInterface :: new ( interface. name . clone ( ) . into ( ) ) ;
282
+ let mut iface = GqlInterface :: new (
283
+ interface. name . clone ( ) . into ( ) ,
284
+ interface. description . as_ref ( ) . map ( |d| d. as_str ( ) ) ,
285
+ ) ;
283
286
iface
284
287
. fields
285
288
. extend ( interface. fields . iter ( ) . map ( |f| GqlObjectField {
@@ -389,7 +392,10 @@ impl ::std::convert::From<::introspection_response::IntrospectionResponse> for S
389
392
. insert ( name. clone ( ) , GqlObject :: from_introspected_schema_json ( ty) ) ;
390
393
}
391
394
Some ( __TypeKind:: INTERFACE ) => {
392
- let mut iface = GqlInterface :: new ( name. clone ( ) . into ( ) ) ;
395
+ let mut iface = GqlInterface :: new (
396
+ name. clone ( ) . into ( ) ,
397
+ ty. description . as_ref ( ) . map ( |t| t. as_str ( ) ) ,
398
+ ) ;
393
399
iface. fields . extend (
394
400
ty. fields
395
401
. clone ( )
You can’t perform that action at this time.
0 commit comments