File tree Expand file tree Collapse file tree 2 files changed +30
-18
lines changed
Expand file tree Collapse file tree 2 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,12 @@ function buildScalarDefinition(node: any): any {
5656
5757 const scalarDoc : any = {
5858 type : scalarType ,
59- description : node . description ,
6059 } ;
6160
61+ if ( node . description ) {
62+ scalarDoc . description = node . description ;
63+ }
64+
6265 return scalarDoc ;
6366}
6467
@@ -68,11 +71,13 @@ function buildObjectDefinition(node: any): any {
6871 objectDoc . type = 'object' ;
6972 objectDoc . properties = { } ;
7073
71- node . inputFields . forEach ( ( field : any ) => {
72- const { type : fieldNode } = field ;
74+ if ( node . inputFields ) {
75+ node . inputFields . forEach ( ( field : any ) => {
76+ const { type : fieldNode } = field ;
7377
74- objectDoc . properties [ field . name ] = buildDefinition ( fieldNode ) ;
75- } ) ;
78+ objectDoc . properties [ field . name ] = buildDefinition ( fieldNode ) ;
79+ } ) ;
80+ }
7681
7782 return objectDoc ;
7883}
@@ -92,10 +97,13 @@ function buildDefinition(node: any): any {
9297function buildEnumDefinition ( node : any ) : any {
9398 const enumDoc : any = {
9499 type : 'string' ,
95- description : node . description ,
96100 enum : [ ] ,
97101 } ;
98102
103+ if ( node . description ) {
104+ enumDoc . description = node . description ;
105+ }
106+
99107 node . enumValues . forEach ( ( enumValue : any ) => {
100108 enumDoc . enum . push ( enumValue . name ) ;
101109 } ) ;
Original file line number Diff line number Diff line change @@ -3,26 +3,30 @@ import Route from './Route';
33
44const TYPE_FRAGMENT = `
55 fragment TypeFragment on __Type {
6- description
7- kind
8- name
9- enumValues {
10- name
11- description
12- }
6+ ...InputField
137 inputFields {
148 name
159 type {
16- kind
17- name
18- description
19- enumValues {
10+ ...InputField
11+ inputFields {
2012 name
21- description
13+ type {
14+ ...InputField
15+ }
2216 }
2317 }
2418 }
2519 }
20+
21+ fragment InputField on __Type {
22+ kind
23+ name
24+ description
25+ enumValues {
26+ name
27+ description
28+ }
29+ }
2630` ;
2731
2832function buildQueryForVariable ( variableName : string ) : string {
You can’t perform that action at this time.
0 commit comments