Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package update #17

Merged
merged 148 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
f40cd36
Support for embedded struct type in resolver
eloyekunle Jun 25, 2019
d5b02b1
fix bug in slice pop
eloyekunle Jun 25, 2019
6110b37
fix bug while finding field
eloyekunle Jul 1, 2019
8f68317
add 'getFieldCount' to resolve ambiguity
eloyekunle Jul 1, 2019
f39c0f0
Increase extensions test coverage
pavelnikolov Sep 2, 2019
641ae19
Remove duplicate unit tests
pavelnikolov Sep 2, 2019
c94cde5
rename 'getFieldCount' to 'fieldCount'
eloyekunle Sep 13, 2019
be8816b
add test for ambiguous field panic
eloyekunle Sep 13, 2019
3f7a8e9
add unit tests for embedded struct feature
eloyekunle Sep 13, 2019
943d21c
rename TestEmbedded => TestEmbeddedStruct
eloyekunle Sep 13, 2019
38a077b
Merge pull request #338 from eloyekunle/master
pavelnikolov Sep 17, 2019
5fe34fd
Fixes #357
MaxInertia Oct 4, 2019
4edb8fa
Actually fix #357
MaxInertia Oct 4, 2019
01c95b0
Print context to panic log
ivanp Oct 8, 2019
0fb5fc2
Add Example of Custom Errors
dackroyd Oct 9, 2019
9068de6
Merge pull request #361 from dackroyd/add-example-of-custom-errors
pavelnikolov Oct 24, 2019
0a9cfbe
Merge pull request #360 from kumparan/old_ver
pavelnikolov Oct 24, 2019
81e957c
Clarify errors for mismatching input implementation
dackroyd Oct 28, 2019
6c0f0e3
Allow `schema` to be omitted when using default root op names
dackroyd Oct 30, 2019
72f6639
Merge pull request #363 from dackroyd/clearer-error-for-input-resolve…
pavelnikolov Oct 30, 2019
a5bf804
Merge pull request #364 from dackroyd/populate-default-entrypoints-wi…
pavelnikolov Oct 30, 2019
4450565
Merge pull request #358 from MaxInertia/master
pavelnikolov Oct 31, 2019
698f651
Strip Common Indentation from BlockString Descriptions
dackroyd Oct 4, 2019
adde0d0
Merge pull request #356 from dackroyd/strip-common-indentation-from-b…
pavelnikolov Oct 31, 2019
5098fd4
Syntax highlighting fixed in README
pavemaksim Nov 13, 2019
5ef3e23
Merge pull request #366 from pavemaksim/patch-1
tonyghita Nov 13, 2019
9508a02
Add walkthrough
zaydek Nov 14, 2019
98f2350
Update README.md
zaydek Nov 14, 2019
f33e813
Merge pull request #367 from ZAYDEK/master
tonyghita Nov 15, 2019
a579090
Add support for directives in schema parser
Dec 17, 2019
d51b8b3
Use operationName from query if missing from POST
Jan 28, 2020
8334863
Merge pull request #374 from willnewrelic/operationName-from-query
pavelnikolov Feb 7, 2020
dae41bd
Merge pull request #370 from Ackar/directives
pavelnikolov Mar 9, 2020
c80e625
Fix SIGSEGV when client subs to multiple fields
Jun 13, 2020
83ba819
Merge pull request #398 from nmaquet/master
pavelnikolov Jun 17, 2020
96ea6f0
bugfix: correctly determine fragment usage
Jun 18, 2020
c1d9693
Merge pull request #399 from rudle/fragment-not-used-bug
tonyghita Jun 22, 2020
ee832ef
Limit the number of concurrent list nodes processed
ryanslade Jun 25, 2020
557f50a
Remove need for WaitGroup
ryanslade Jun 25, 2020
90e03d2
More descriptive error when unmarshaling ID/Time
mrnugget Jun 30, 2020
f3aefbe
Improve README.md
obeis Jul 30, 2020
5e581ee
Merge pull request #405 from obeis/master
pavelnikolov Aug 19, 2020
3b5ddcd
Merge pull request #402 from mrnugget/sourcegraph/better-error-msg
pavelnikolov Aug 19, 2020
5b0cad1
fix #241
sqs Sep 25, 2020
4659b07
Add comment explaining why we limit concurrency
ryanslade Sep 30, 2020
c5bdf3b
Merge pull request #400 from sourcegraph/limit-goroutines
pavelnikolov Oct 3, 2020
4fe2a6b
Issue #299: unclear error message in case of multiline string argument
suntoucha Oct 6, 2020
653514d
handle case where interface is type-asserted to same interface
sqs Oct 7, 2020
fff3ceb
Issue #299: unclear error message in case of multiline strings
suntoucha Oct 7, 2020
43e20d2
Issue #299: unclear error message in case of multiline string argument
suntoucha Oct 6, 2020
cd7bafd
Issue 299: unclear error messages in case of multiline strings
suntoucha Oct 7, 2020
3152bd3
Update logic to always check for nil pointer returns
Oct 9, 2020
135c6ff
Adding variables parameter for query validations.
smotavitaendava Oct 16, 2020
4c772c1
Merge pull request #413 from OuranosSkia/AlwaysCheckNil
tonyghita Oct 27, 2020
848e84a
Fixed `reflect.Value.Type on zero Value` panic when subscription reso…
Nov 11, 2020
d77614a
Added possibility to customize subscription resolver timeout value
Nov 11, 2020
46cf654
Allowed Subscription resolver to return `*QueryError` directly
Nov 11, 2020
7a585a0
Merge pull request #418 from dfuse-io/feature/subscribe-resolver-timeout
pavelnikolov Nov 12, 2020
3c9ac91
Merge pull request #420 from dfuse-io/feature/subscription-query-error
pavelnikolov Nov 12, 2020
5940bf3
Merge branch 'master' into fix/subscription-panic-in-resolver
Nov 12, 2020
1f70736
Merge pull request #417 from dfuse-io/fix/subscription-panic-in-resolver
pavelnikolov Nov 12, 2020
d5f4f41
Merge pull request #415 from smotavitaendava/master
pavelnikolov Nov 13, 2020
4af9f16
Adding/removing empty lines where needed
suntoucha Nov 13, 2020
9c36bba
Merge pull request #412 from suntoucha/master
pavelnikolov Nov 13, 2020
beb923f
Merge pull request #409 from sourcegraph/fix-union-interface-inline-f…
pavelnikolov Nov 13, 2020
7db17b6
DisableIntrospection should not skip __typename for usages of GraphQL…
Epsirom Nov 17, 2020
1a55b96
Add context to validation tracing
dackroyd Oct 1, 2020
fced4f6
Add support for nullable types
Jan 14, 2021
6859f27
Merge pull request #430 from Ackar/nullable-types
pavelnikolov Mar 5, 2021
bd703c2
Merge pull request #411 from dackroyd/trace-validation-context
pavelnikolov Mar 6, 2021
d2656e8
Merge pull request #423 from Epsirom/master
pavelnikolov Mar 19, 2021
fe4cb53
Fixed duplicated __typename in response (fixes #369)
eko Mar 29, 2021
21b77bd
Merge pull request #443 from eko/fix-369
pavelnikolov Mar 29, 2021
e0b00b8
Create CHANGELOG.md
pavelnikolov Apr 13, 2021
1a8cd9c
Update CHANGELOG.md
pavelnikolov Apr 13, 2021
c46cc71
ignore JetBrains IDEA and vscode meta directories
sGy1980de Apr 20, 2021
04aa634
expose packer.Unmarshaler interface as graphql.Unmarshaler
sGy1980de Apr 20, 2021
60ab3c8
move packer.Unmarshaler interface to decode.Unmarshaler, so the metho…
sGy1980de Apr 20, 2021
21f7aef
Merge pull request #450 from esome/master
pavelnikolov Apr 21, 2021
bf0a0cc
add types package
Mar 16, 2021
d3bed17
add getter for the types.Schema field
Mar 17, 2021
d0dc5cd
unused fields
Mar 18, 2021
31fbb90
rename to match types
Mar 18, 2021
2af5fa3
remove unused
Mar 29, 2021
d579b56
use a string and not an Ident for a FieldDefinition's name
Mar 30, 2021
9d304f9
fix compile errors introduced by ab449f07e
Mar 30, 2021
502fac2
merge conflict errors
Apr 22, 2021
8a96404
Merge pull request #437 from rudle/types-leaf-package
pavelnikolov Apr 23, 2021
242dace
add location fields to type definitions
benevolent-donut Apr 27, 2021
5b1abb9
Fix dir in readme
jinleileiking Apr 29, 2021
8967594
Merge pull request #452 from jinleileiking/patch-1
pavelnikolov Apr 29, 2021
422bda0
coerce float64 to int32 in NullInt and vice versa in NullFloat
Apr 29, 2021
c126754
errors.Errorf preserves original error similar to fmt.Error
savaki Apr 30, 2021
d887704
removed test dependency on errors.Is
savaki Apr 30, 2021
ce94028
checkErrors ignores the raw error for purposes of determining if the …
savaki Apr 30, 2021
b8f211c
Merge pull request #454 from ssko1/loc-types
pavelnikolov Apr 30, 2021
4378f8e
Merge pull request #456 from savaki/master
pavelnikolov Apr 30, 2021
7aec311
Update CHANGELOG.md
pavelnikolov Apr 30, 2021
687d3ab
Merge remote-tracking branch 'upstream/master' into coerce-null-int
May 3, 2021
091f91f
Merge pull request #453 from Kalbi/coerce-null-int
pavelnikolov May 4, 2021
8b5d032
internal/exec: assign parent type name to __typename fields
tonyghita Jun 10, 2021
af5bb93
Merge pull request #462 from graph-gophers/fix-typename-trace
pavelnikolov Jun 10, 2021
5457f60
Accepting value Json in parameter of request's body in custom Scalar…
GustavoDelfim Sep 13, 2021
446a2dd
Add option for custom panic handler (#468)
JohnStarich Sep 16, 2021
1a8be64
Tests showing query variables are validated correctly (#470)
suessflorian Oct 5, 2021
c32bb42
README nit -- Move '$' out of cut/paste buffer (#473)
wejafoo Oct 27, 2021
aa16691
internal/exec/resolvable: include struct field name in errors (#477)
agnivade Dec 9, 2021
417fcd2
ci: setup SemaphoreCI v2 (#479)
tonyghita Dec 10, 2021
21d1871
Support "Interfaces Implementing Interfaces" (#471)
suessflorian Dec 10, 2021
8672be4
README.md: Fix build status badge
tonyghita Dec 11, 2021
5b025f5
Merge pull request #480 from graph-gophers/fix-readme-build-status
tonyghita Dec 11, 2021
5a4e6a3
fix golangci lint errors in the codebase (#478)
agnivade Dec 13, 2021
da45ffe
Improve Sempahore CI (#481)
agnivade Dec 15, 2021
9379f9d
Make some more golang-ci improvements (#483)
agnivade Dec 17, 2021
9d31459
graphql.Time unmarshal unix nano time (#486)
pavelnikolov Dec 21, 2021
eae31ca
validation: fix bug in maxDepth fragment spread logic (#492)
tonyghita Jan 18, 2022
e3f5859
Create codeql-analysis.yml
pavelnikolov Jan 20, 2022
c2fd39a
Add OpenTelemetry Support (#493)
steve-gray Jan 20, 2022
f942e27
Improve the Getting Started section
pavelnikolov Jan 20, 2022
e3e8cf0
Update README.md
pavelnikolov Jan 20, 2022
e6618d4
Improve the Getting Started section in the README
pavelnikolov Jan 20, 2022
ff0c18a
Create SECURITY.md
pavelnikolov Jan 20, 2022
ef6fd96
Fix the OTEL tracer package name (#495)
pavelnikolov Jan 21, 2022
eb32f6c
Fix parseObjectDef will terminate when object has bad syntax (#491) (…
cnnrrss Feb 23, 2022
9296b87
Fix remove checkNilCase test helper function (#504)
cnnrrss Mar 1, 2022
d48b659
Add graphql.Time example (#508)
roaris Mar 20, 2022
67f7173
Apollo Federation Spec: Fetch service capabilities (#507)
aeramu Mar 20, 2022
426e470
Ignore yarn.lock file
pavelnikolov Mar 20, 2022
0140894
add support for repeatable directives (#502)
speezepearson Mar 20, 2022
f56ac25
Fix example/social code (#510)
roaris Mar 21, 2022
7c39d63
Fix lint error (#512)
pavelnikolov Apr 10, 2022
24abfa5
Refactor trace package (#513)
pavelnikolov Apr 10, 2022
ce6dc97
Adding in primitive value validation. (#515)
BigBallard Apr 13, 2022
e767024
Update README.md
pavelnikolov Apr 13, 2022
3a8c713
Update README.md
pavelnikolov Apr 13, 2022
5a1c172
Improve type assertion method argument validation (require zero) (#516)
kainosnoema May 12, 2022
64f8084
Disallow repeat of non repeatable directives (#525)
ostrea Jul 20, 2022
8557171
synced with latest graphql-gophers
mittalaa Aug 1, 2022
86f5bb0
Added changes lost after package update
kumaramritansh Aug 1, 2022
06a882d
Merge pull request #18 from tokopedia/previous_changes
mittalaa Aug 1, 2022
e1e0243
merging old prs
mittalaa Aug 1, 2022
e788b87
adding gqlerrors support
mittalaa Aug 11, 2022
9c90c13
adding dev message, error code support
mittalaa Aug 11, 2022
e92a45a
Readded Export query name method functionality after package update
kumaramritansh Oct 25, 2022
64f230f
Merge pull request #21 from tokopedia/package-update-export-query-name
kumaramritansh Nov 4, 2022
12026c7
resolving conflicts, removed codeql-analysis.yml
mittalaa Nov 7, 2022
c7c9ca6
Fix: extension initialisation and updated error method to return exte…
kumaramritansh Nov 7, 2022
2b4db5a
updated QueryError Extensions to not emit if empty
kumaramritansh Nov 11, 2022
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.idea
/.vscode
/internal/validation/testdata/graphql-js
/internal/validation/testdata/node_modules
/vendor
35 changes: 35 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
run:
timeout: 5m

linters-settings:
gofmt:
simplify: true
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
- deepequalerrors # remove later

linters:
disable-all: true
enable:
- deadcode
- gofmt
- gosimple
- govet
- ineffassign
- exportloopref
- structcheck
- staticcheck
- unconvert
- unused
- varcheck
- misspell
- goimports

issues:
exclude-rules:
- linters:
- unused
path: "graphql_test.go"
35 changes: 35 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: v1.0
name: Go
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
blocks:
- name: Style Check
task:
jobs:
- name: fmt
commands:
- sem-version go 1.17
- checkout
- ./scripts/golangci_install.sh -b $(go env GOPATH)/bin v1.42.1
- export PATH=$(go env GOPATH)/bin:$PATH
- golangci-lint run ./...

- name: Test & Build
task:
prologue:
commands:
- sem-version go 1.17
- export PATH=$(go env GOPATH)/bin:$PATH
- checkout
- go version

jobs:
- name: Test
commands:
- go test ./...

- name: Build
commands:
- go build -v .
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CHANGELOG

[v1.1.0](https://github.com/tokopedia/graphql-go/releases/tag/v1.1.0) Release v1.1.0
* [FEATURE] Add types package #437
* [FEATURE] Expose `packer.Unmarshaler` as `decode.Unmarshaler` to the public #450
* [FEATURE] Add location fields to type definitions #454
* [FEATURE] `errors.Errorf` preserves original error similar to `fmt.Errorf` #456
* [BUGFIX] Fix duplicated __typename in response (fixes #369) #443

[v1.0.0](https://github.com/tokopedia/graphql-go/releases/tag/v1.0.0) Initial release
135 changes: 121 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# graphql-go [![Sourcegraph](https://sourcegraph.com/github.com/tokopedia/graphql-go/-/badge.svg)](https://sourcegraph.com/github.com/tokopedia/graphql-go?badge) [![Build Status](https://semaphoreci.com/api/v1/graph-gophers/graphql-go/branches/master/badge.svg)](https://semaphoreci.com/graph-gophers/graphql-go) [![GoDoc](https://godoc.org/github.com/tokopedia/graphql-go?status.svg)](https://godoc.org/github.com/tokopedia/graphql-go)
# graphql-go [![Sourcegraph](https://sourcegraph.com/github.com/tokopedia/graphql-go/-/badge.svg)](https://sourcegraph.com/github.com/tokopedia/graphql-go?badge) [![Build Status](https://tokopedia.semaphoreci.com/badges/graphql-go/branches/master.svg?style=shields)](https://tokopedia.semaphoreci.com/projects/graphql-go) [![GoDoc](https://godoc.org/github.com/tokopedia/graphql-go?status.svg)](https://godoc.org/github.com/tokopedia/graphql-go)

<p align="center"><img src="docs/img/logo.png" width="300"></p>

Expand All @@ -11,13 +11,13 @@ safe for production use.

- minimal API
- support for `context.Context`
- support for the `OpenTracing` standard
- support for the `OpenTelemetry` and `OpenTracing` standards
- schema type-checking against resolvers
- resolvers are matched to the schema based on method sets (can resolve a GraphQL schema with a Go interface or Go struct).
- handles panics in resolvers
- parallel execution of resolvers
- subscriptions
- [sample WS transport](https://github.com/graph-gophers/graphql-transport-ws)
- [sample WS transport](https://github.com/tokopedia/graphql-transport-ws)

## Roadmap

Expand All @@ -26,8 +26,9 @@ Feedback is welcome and appreciated.

## (Some) Documentation

### Basic Sample
### Getting started

In order to run a simple GraphQL server locally create a `main.go` file with the following content:
```go
package main

Expand All @@ -45,9 +46,6 @@ func (_ *query) Hello() string { return "Hello, world!" }

func main() {
s := `
schema {
query: Query
}
type Query {
hello: String!
}
Expand All @@ -57,11 +55,12 @@ func main() {
log.Fatal(http.ListenAndServe(":8080", nil))
}
```

To test:
Then run the file with `go run main.go`. To test:
```sh
$ curl -XPOST -d '{"query": "{ hello }"}' localhost:8080/query
curl -XPOST -d '{"query": "{ hello }"}' localhost:8080/query
```
For more realistic usecases check our [examples section](https://github.com/tokopedia/graphql-go/wiki/Examples).

### Resolvers

Expand Down Expand Up @@ -103,10 +102,118 @@ func (r *helloWorldResolver) Hello(ctx context.Context) (string, error) {
}
```

### Community Examples
### Schema Options

- `UseStringDescriptions()` enables the usage of double quoted and triple quoted. When this is not enabled, comments are parsed as descriptions instead.
- `UseFieldResolvers()` specifies whether to use struct field resolvers.
- `MaxDepth(n int)` specifies the maximum field nesting depth in a query. The default is 0 which disables max depth checking.
- `MaxParallelism(n int)` specifies the maximum number of resolvers per request allowed to run in parallel. The default is 10.
- `Tracer(tracer trace.Tracer)` is used to trace queries and fields. It defaults to `noop.Tracer`.
- `Logger(logger log.Logger)` is used to log panics during query execution. It defaults to `exec.DefaultLogger`.
- `PanicHandler(panicHandler errors.PanicHandler)` is used to transform panics into errors during query execution. It defaults to `errors.DefaultPanicHandler`.
- `DisableIntrospection()` disables introspection queries.

### Custom Errors

Errors returned by resolvers can include custom extensions by implementing the `ResolverError` interface:

```go
type ResolverError interface {
error
Extensions() map[string]interface{}
}
```

Example of a simple custom error:

```go
type droidNotFoundError struct {
Code string `json:"code"`
Message string `json:"message"`
}

func (e droidNotFoundError) Error() string {
return fmt.Sprintf("error [%s]: %s", e.Code, e.Message)
}

func (e droidNotFoundError) Extensions() map[string]interface{} {
return map[string]interface{}{
"code": e.Code,
"message": e.Message,
}
}
```

Which could produce a GraphQL error such as:

```go
{
"errors": [
{
"message": "error [NotFound]: This is not the droid you are looking for",
"path": [
"droid"
],
"extensions": {
"code": "NotFound",
"message": "This is not the droid you are looking for"
}
}
],
"data": null
}
```

### Tracing

By default the library uses `noop.Tracer`. If you want to change that you can use the OpenTelemetry or the OpenTracing implementations, respectively:

```go
// OpenTelemetry tracer
package main

import (
"github.com/tokopedia/graphql-go"
"github.com/tokopedia/graphql-go/example/starwars"
otelgraphql "github.com/tokopedia/graphql-go/trace/otel"
"github.com/tokopedia/graphql-go/trace/tracer"
)
// ...
_, err := graphql.ParseSchema(starwars.Schema, nil, graphql.Tracer(otelgraphql.DefaultTracer()))
// ...
```
Alternatively you can pass an existing trace.Tracer instance:
```go
tr := otel.Tracer("example")
_, err = graphql.ParseSchema(starwars.Schema, nil, graphql.Tracer(&otelgraphql.Tracer{Tracer: tr}))
```


```go
// OpenTracing tracer
package main

import (
"github.com/tokopedia/graphql-go"
"github.com/tokopedia/graphql-go/example/starwars"
"github.com/tokopedia/graphql-go/trace/opentracing"
"github.com/tokopedia/graphql-go/trace/tracer"
)
// ...
_, err := graphql.ParseSchema(starwars.Schema, nil, graphql.Tracer(opentracing.Tracer{}))

// ...
```

If you need to implement a custom tracer the library would accept any tracer which implements the interface below:
```go
type Tracer interface {
TraceQuery(ctx context.Context, queryString string, operationName string, variables map[string]interface{}, varTypes map[string]*introspection.Type) (context.Context, func([]*errors.QueryError))
TraceField(ctx context.Context, label, typeName, fieldName string, trivial bool, args map[string]interface{}) (context.Context, func(*errors.QueryError))
TraceValidation(context.Context) func([]*errors.QueryError)
}
```

[tonyghita/graphql-go-example](https://github.com/tonyghita/graphql-go-example) - A more "productionized" version of the Star Wars API example given in this repository.

[deltaskelta/graphql-go-pets-example](https://github.com/deltaskelta/graphql-go-pets-example) - graphql-go resolving against a sqlite database
### [Examples](https://github.com/tokopedia/graphql-go/wiki/Examples)

[OscarYuen/go-graphql-starter](https://github.com/OscarYuen/go-graphql-starter) - a starter application integrated with dataloader, psql and basic authentication
17 changes: 17 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Security Policy

## Supported Versions

We always try to maintain the library secure and suggest our users to upgrade to the latest stable version. We realize that sometimes this is not possible.

| Version | Supported |
| ------- | ------------------ |
| 1.x | :white_check_mark: |
| < 1.0 | :x: |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were synced to this commit graph-gophers@64f8084 committed on Jul 20 2022 and the latest stable version is v1.4.0 which was released on April 11 2022 so this syncup with graphq-gophers/graphql-go is free of MaxDepth security vulnerability as this vulnerability is detected in versions <v1.3.0

GHSA-mh3m-8c74-74xh

## MaxDepth
If you are using the `graphql.MaxDepth` schema option, make sure that you upgrade to version v1.3.0 or higher due to a bug causing security vulnerability in earlier versions.

## Reporting a Vulnerability

If you find a security vulnerability with this library, please, DO NOT submit a pull request right away. Please, report the issue to @pavelnikolov and/or @tony in the Gophers Slack in a private message.
13 changes: 13 additions & 0 deletions decode/decode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package decode

// Unmarshaler defines the api of Go types mapped to custom GraphQL scalar types
type Unmarshaler interface {
// ImplementsGraphQLType maps the implementing custom Go type
// to the GraphQL scalar type in the schema.
ImplementsGraphQLType(name string) bool
// UnmarshalGraphQL is the custom unmarshaler for the implementing type
//
// This function will be called whenever you use the
// custom GraphQL scalar type as an input
UnmarshalGraphQL(input interface{}) error
}
Loading