Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit da75ecd

Browse files
committed
fixed introspection package
1 parent c445502 commit da75ecd

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

internal/introspection/introspection.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// introspection implements the spec defined in https://github.com/facebook/graphql/blob/master/spec/Section%204%20--%20Introspection.md#schema-introspection
12
package introspection
23

34
import (
@@ -9,6 +10,7 @@ import (
910
"github.com/Code-Hex/gqldoc/internal/pool"
1011
)
1112

13+
// https://github.com/graphql/graphql-js/blob/main/src/utilities/getIntrospectionQuery.js
1214
const Query = `
1315
query IntrospectionQuery {
1416
__schema {
@@ -137,7 +139,7 @@ type Schema struct {
137139
MutationType *OperationType `json:"mutationType"`
138140
SubscriptionType *OperationType `json:"subscriptionType"`
139141
Types []*Types `json:"types"`
140-
Directives []*Directives `json:"directives"`
142+
Directives []*Directive `json:"directives"`
141143

142144
memoizeTypes map[string]*Types
143145
}
@@ -400,10 +402,12 @@ func (a Args) String() string {
400402
}
401403

402404
type Arg struct {
403-
Name string `json:"name"`
404-
Description string `json:"description"`
405-
Type *Type `json:"type"`
406-
DefaultValue *string `json:"defaultValue"`
405+
Name string `json:"name"`
406+
Description string `json:"description"`
407+
Type *Type `json:"type"`
408+
DefaultValue *string `json:"defaultValue"`
409+
IsDeprecated bool `json:"isDeprecated"`
410+
DeprecationReason string `json:"deprecationReason"`
407411
}
408412

409413
func (a *Arg) String() string {
@@ -417,14 +421,14 @@ func (a *Arg) String() string {
417421
return ret
418422
}
419423

420-
type Directives struct {
424+
type Directive struct {
421425
Name string `json:"name"`
422426
Description string `json:"description"`
423427
Locations []string `json:"locations"`
424428
Args Args `json:"args"`
425429
}
426430

427-
func (d *Directives) String() string {
431+
func (d *Directive) String() string {
428432
if d == nil {
429433
return ""
430434
}
@@ -473,10 +477,12 @@ func (f *Field) String() string {
473477
}
474478

475479
type InputValue struct {
476-
Name string `json:"name"`
477-
Description string `json:"description"`
478-
Type *Type `json:"type"`
479-
DefaultValue *string `json:"defaultValue"`
480+
Name string `json:"name"`
481+
Description string `json:"description"`
482+
Type *Type `json:"type"`
483+
DefaultValue *string `json:"defaultValue"`
484+
IsDeprecated bool `json:"isDeprecated"`
485+
DeprecationReason string `json:"deprecationReason"`
480486
}
481487

482488
func (i *InputValue) String() string {

0 commit comments

Comments
 (0)