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;
1010
1111#[ derive( Debug , PartialEq ) ]
1212pub struct GqlInterface {
13+ pub description : Option < String > ,
1314 pub implemented_by : HashSet < String > ,
1415 pub name : String ,
1516 pub fields : Vec < GqlObjectField > ,
1617}
1718
1819impl GqlInterface {
19- pub fn new ( name : Cow < str > ) -> GqlInterface {
20+ pub fn new ( name : Cow < str > , description : Option < & str > ) -> GqlInterface {
2021 GqlInterface {
22+ description : description. map ( |d| d. to_owned ( ) ) ,
2123 name : name. into_owned ( ) ,
2224 implemented_by : HashSet :: new ( ) ,
2325 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 {
279279 schema. unions . insert ( union. name , GqlUnion ( tys) ) ;
280280 }
281281 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+ ) ;
283286 iface
284287 . fields
285288 . extend ( interface. fields . iter ( ) . map ( |f| GqlObjectField {
@@ -389,7 +392,10 @@ impl ::std::convert::From<::introspection_response::IntrospectionResponse> for S
389392 . insert ( name. clone ( ) , GqlObject :: from_introspected_schema_json ( ty) ) ;
390393 }
391394 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+ ) ;
393399 iface. fields . extend (
394400 ty. fields
395401 . clone ( )
You can’t perform that action at this time.
0 commit comments