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

Add specifiedBy in introspection #21

Merged
merged 8 commits into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions example/github/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -30190,6 +30190,10 @@ blank, the sponsorships will be ordered based on relevancy to the viewer.</p></p
<td><strong>tier</strong> (<a href="objects.md#sponsorstier">SponsorsTier</a>)</td>
<td><p>The associated sponsorship tier</p></td>
</tr>
<tr>
<td><strong>tierSelectedAt</strong> (<a href="scalars.md#datetime">DateTime</a>)</td>
<td><p>Identifies the date and time when the current tier was chosen for this sponsorship.</p></td>
</tr>
</table>

---
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/agnivade/levenshtein v1.1.0 // indirect
github.com/goccy/go-yaml v1.8.9
github.com/google/go-cmp v0.5.5
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500 // indirect
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393 // indirect
github.com/machinebox/graphql v0.2.2
github.com/matryer/is v1.4.0 // indirect
github.com/mattn/go-zglob v0.0.3
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406023454-534efe0eae8e h1:dF5TaS3uw9
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406023454-534efe0eae8e/go.mod h1:0sYgRh/Er/ZhHrcKw516TOX4K0ul94vKcBSXAPhLWDc=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500 h1:MU4UNUZ+6KtOt1Kv6AQSefKvSW+6mNoZfrX+A8y82yc=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210406143310-243d3ee28500/go.mod h1:tcoG4afq1O8aR/IjCYadz/CWSie6ouAQYfoAPoNqdmA=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410035123-2a4e628b7612 h1:9n+WVGphaTd6j10xqUQ6NdQGKy2mhdyEtxWDF+OYfkI=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410035123-2a4e628b7612/go.mod h1:qU2DZu18blZvWc+6KoEbeTJy5PT2jav/rO1byy47iRU=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393 h1:85IH4c5AH0yzTlC6OA6t33jF3B8oK3hOEoBOOvrXxu8=
github.com/gqlgo/gqlparser/v2 v2.1.1-0.20210410045713-c9e512f85393/go.mod h1:qU2DZu18blZvWc+6KoEbeTJy5PT2jav/rO1byy47iRU=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down
14 changes: 14 additions & 0 deletions internal/gqlgen/gqlgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ func (e *ExecutableSchema) Exec(oc *graphql.OperationContext, opts ...ExecOption
return &buf
}

var (
queryImplementors = []string{"Query"}

__DirectiveImplementors = []string{"__Directive"}
__EnumValueImplementors = []string{"__EnumValue"}
__FieldImplementors = []string{"__Field"}
__InputValueImplementors = []string{"__InputValue"}
__SchemaImplementors = []string{"__Schema"}
__TypeImplementors = []string{"__Type"}
)

type executionContext struct {
*graphql.OperationContext
*ExecutableSchema
Expand Down Expand Up @@ -382,6 +393,9 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o
case "ofType":
res := obj.OfType()
out.Values[i] = ec.marshalType(ctx, field.Selections, res)
case "specifiedBy":
res := obj.SpecifiedBy()
out.Values[i] = marshalNullableString(res)
default:
panic("unknown field " + strconv.Quote(field.Name))
}
Expand Down
Loading