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

Commit e0d40d8

Browse files
authored
Merge pull request #21 from Code-Hex/add/specifiedBy
Add specifiedBy in introspection
2 parents 19f5b9b + e6da01e commit e0d40d8

File tree

10 files changed

+84
-2131
lines changed

10 files changed

+84
-2131
lines changed

example/github/objects.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30190,6 +30190,10 @@ blank, the sponsorships will be ordered based on relevancy to the viewer.</p></p
3019030190
<td><strong>tier</strong> (<a href="objects.md#sponsorstier">SponsorsTier</a>)</td>
3019130191
<td><p>The associated sponsorship tier</p></td>
3019230192
</tr>
30193+
<tr>
30194+
<td><strong>tierSelectedAt</strong> (<a href="scalars.md#datetime">DateTime</a>)</td>
30195+
<td><p>Identifies the date and time when the current tier was chosen for this sponsorship.</p></td>
30196+
</tr>
3019330197
</table>
3019430198

3019530199
---

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/agnivade/levenshtein v1.1.0 // indirect
88
github.com/goccy/go-yaml v1.8.9
99
github.com/google/go-cmp v0.5.5
10-
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500 // indirect
10+
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393 // indirect
1111
github.com/machinebox/graphql v0.2.2
1212
github.com/matryer/is v1.4.0 // indirect
1313
github.com/mattn/go-zglob v0.0.3

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406023454-534efe0eae8e h1:dF5TaS3uw9
4141
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406023454-534efe0eae8e/go.mod h1:0sYgRh/Er/ZhHrcKw516TOX4K0ul94vKcBSXAPhLWDc=
4242
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500 h1:MU4UNUZ+6KtOt1Kv6AQSefKvSW+6mNoZfrX+A8y82yc=
4343
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500/go.mod h1:tcoG4afq1O8aR/IjCYadz/CWSie6ouAQYfoAPoNqdmA=
44+
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410035123-2a4e628b7612 h1:9n+WVGphaTd6j10xqUQ6NdQGKy2mhdyEtxWDF+OYfkI=
45+
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410035123-2a4e628b7612/go.mod h1:qU2DZu18blZvWc+6KoEbeTJy5PT2jav/rO1byy47iRU=
46+
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393 h1:85IH4c5AH0yzTlC6OA6t33jF3B8oK3hOEoBOOvrXxu8=
47+
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393/go.mod h1:qU2DZu18blZvWc+6KoEbeTJy5PT2jav/rO1byy47iRU=
4448
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
4549
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
4650
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=

internal/gqlgen/gqlgen.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ func (e *ExecutableSchema) Exec(oc *graphql.OperationContext, opts ...ExecOption
106106
return &buf
107107
}
108108

109+
var (
110+
queryImplementors = []string{"Query"}
111+
112+
__DirectiveImplementors = []string{"__Directive"}
113+
__EnumValueImplementors = []string{"__EnumValue"}
114+
__FieldImplementors = []string{"__Field"}
115+
__InputValueImplementors = []string{"__InputValue"}
116+
__SchemaImplementors = []string{"__Schema"}
117+
__TypeImplementors = []string{"__Type"}
118+
)
119+
109120
type executionContext struct {
110121
*graphql.OperationContext
111122
*ExecutableSchema
@@ -382,6 +393,9 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o
382393
case "ofType":
383394
res := obj.OfType()
384395
out.Values[i] = ec.marshalType(ctx, field.Selections, res)
396+
case "specifiedBy":
397+
res := obj.SpecifiedBy()
398+
out.Values[i] = marshalNullableString(res)
385399
default:
386400
panic("unknown field " + strconv.Quote(field.Name))
387401
}

0 commit comments

Comments
 (0)