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

Commit

Permalink
Merge pull request #21 from Code-Hex/add/specifiedBy
Browse files Browse the repository at this point in the history
Add specifiedBy in introspection
  • Loading branch information
Code-Hex committed Apr 10, 2021
2 parents 19f5b9b + e6da01e commit e0d40d8
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 2,131 deletions.
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

0 comments on commit e0d40d8

Please sign in to comment.