@@ -26,11 +26,11 @@ type Data struct {
26
26
// operation.
27
27
// See https://spec.graphql.org/June2018/#sec-Schema-Introspection
28
28
type __Schema struct {
29
- Types []__Type `json:"types"`
30
- QueryType SchemaType `json:"queryType"`
31
- MutationType SchemaType `json:"mutationType"`
32
- SubscriptionType SchemaType `json:"subscriptionType"`
33
- Directives []__Directive `json:"directives"`
29
+ Types []__ObjectType `json:"types"`
30
+ QueryType SchemaType `json:"queryType"`
31
+ MutationType SchemaType `json:"mutationType"`
32
+ SubscriptionType SchemaType `json:"subscriptionType"`
33
+ Directives []__Directive `json:"directives"`
34
34
}
35
35
36
36
// Sort the child arrays of Schema
@@ -68,29 +68,29 @@ func (s *__Schema) Sort() {
68
68
// See https://spec.graphql.org/June2018/#sec-The-__Type-Type
69
69
type __Type struct {
70
70
Kind __TypeKind `json:"kind"`
71
- Name string `json:"name,omitempty "`
72
- Description string `json:"description,omitempty "`
71
+ Name string `json:"name"`
72
+ Description string `json:"description"`
73
73
74
74
// OBJECT and INTERFACE only
75
- Fields []__Field `json:"fields,omitempty "`
75
+ Fields []__Field `json:"fields"`
76
76
77
77
// OBJECT only
78
- Interfaces []__Type `json:"interfaces,omitempty "`
78
+ Interfaces []__Type `json:"interfaces"`
79
79
80
80
// INTERFACE and UNION only
81
- PossibleTypes []__Type `json:"possibleTypes,omitempty "`
81
+ PossibleTypes []__Type `json:"possibleTypes"`
82
82
83
83
// ENUM only
84
- EnumValues []EnumValue `json:"enumValue,omitempty "`
84
+ EnumValues []EnumValue `json:"enumValues "`
85
85
86
86
// INPUT_OBJECT only
87
- InputFields []__InputValue `json:"inputFields,omitempty "`
87
+ InputFields []__InputValue `json:"inputFields"`
88
88
89
89
// NON_NULL and LIST only
90
90
OfType * __Type `json:"ofType,omitempty"`
91
91
}
92
92
93
- // Sort the child arrays of GraphQLType
93
+ // Sort the child arrays of __Type
94
94
func (t * __Type ) Sort () {
95
95
sort .Slice (t .Fields , func (i , j int ) bool {
96
96
return t .Fields [i ].Name < t .Fields [j ].Name
@@ -124,6 +124,62 @@ func (t *__Type) Sort() {
124
124
})
125
125
}
126
126
127
+ // Similar to __Type but without OfType
128
+ type __ObjectType struct {
129
+ Kind __TypeKind `json:"kind"`
130
+ Name string `json:"name"`
131
+ Description string `json:"description"`
132
+
133
+ // OBJECT and INTERFACE only
134
+ Fields []__Field `json:"fields"`
135
+
136
+ // OBJECT only
137
+ Interfaces []__Type `json:"interfaces"`
138
+
139
+ // INTERFACE and UNION only
140
+ PossibleTypes []__Type `json:"possibleTypes"`
141
+
142
+ // ENUM only
143
+ EnumValues []EnumValue `json:"enumValues"`
144
+
145
+ // INPUT_OBJECT only
146
+ InputFields []__InputValue `json:"inputFields"`
147
+ }
148
+
149
+ // Sort the child arrays of __ObjectType
150
+ func (t * __ObjectType ) Sort () {
151
+ sort .Slice (t .Fields , func (i , j int ) bool {
152
+ return t .Fields [i ].Name < t .Fields [j ].Name
153
+ })
154
+ for i := range t .Fields {
155
+ sort .Slice (t .Fields [i ].Args , func (j , k int ) bool {
156
+ return t .Fields [i ].Args [j ].Name < t .Fields [i ].Args [k ].Name
157
+ })
158
+ }
159
+
160
+ sort .Slice (t .Interfaces , func (i , j int ) bool {
161
+ return t .Interfaces [i ].Name < t .Interfaces [j ].Name
162
+ })
163
+ for i := range t .Interfaces {
164
+ t .Interfaces [i ].Sort ()
165
+ }
166
+
167
+ sort .Slice (t .PossibleTypes , func (i , j int ) bool {
168
+ return t .PossibleTypes [i ].Name < t .PossibleTypes [j ].Name
169
+ })
170
+ for i := range t .PossibleTypes {
171
+ t .PossibleTypes [i ].Sort ()
172
+ }
173
+
174
+ sort .Slice (t .EnumValues , func (i , j int ) bool {
175
+ return t .EnumValues [i ].Name < t .EnumValues [j ].Name
176
+ })
177
+
178
+ sort .Slice (t .InputFields , func (i , j int ) bool {
179
+ return t .InputFields [i ].Name < t .InputFields [j ].Name
180
+ })
181
+ }
182
+
127
183
// There are several different kinds of type. In each kind, different fields
128
184
// are actually valid. These kinds are listed in the __TypeKind enumeration.
129
185
//
@@ -145,22 +201,22 @@ const (
145
201
// See https://spec.graphql.org/June2018/#sec-The-__Field-Type
146
202
type __Field struct {
147
203
Name string `json:"name,omitempty"`
148
- Description string `json:"description,omitempty "`
204
+ Description string `json:"description"`
149
205
Args []__InputValue `json:"args"`
150
206
Type __Type `json:"type"`
151
207
IsDeprecated bool `json:"isDeprecated"`
152
- DeprecationReason string `json:"deprecationReason,omitempty "`
208
+ DeprecationReason * string `json:"deprecationReason"`
153
209
}
154
210
155
211
// The __InputValue type represents field and directive arguments as well as
156
212
// the inputFields of an input object.
157
213
//
158
214
// See https://spec.graphql.org/June2018/#sec-The-__InputValue-Type
159
215
type __InputValue struct {
160
- Name string `json:"name"`
161
- Description string `json:"description,omitempty"`
162
- Type __Type `json:"type"`
163
- DefaultValue string `json:"defaultValue"`
216
+ Name string `json:"name"`
217
+ Description string `json:"description,omitempty"`
218
+ Type __Type `json:"type"`
219
+ DefaultValue * string `json:"defaultValue"`
164
220
}
165
221
166
222
// The __EnumValue type represents one of possible values of an enum.
0 commit comments