Repository navigation
Releases
v0.14.0
What's Changed
Features
- feat: add ArgsAs, SourceAs and Optional by @seriallink in #195
- feat: add TypedField by @seriallink in #202
- feat: add TypedEnum by @seriallink in #207
- feat: correct enum values of another Go type in strict serialization by @seriallink in #211
Specification compliance
- fix: reject input object fields with an invalid name by @seriallink in #209
Bug fixes
- fix: compute possible types when the schema is built by @seriallink in #180
- fix: format syntax errors in linear time by @seriallink in #183
- fix: key normalized plans on directives, variable defaults and strings by @seriallink in #184
- fix: key normalized plans on the whole document by @seriallink in #185
- fix: visit and print nested values in linear time by @seriallink in #190
- fix: stop sending subscription results once the context is done by @seriallink in #191
- fix: recover panics in ParseLiteral outside field execution by @seriallink in #194
- fix: resume lexing at the byte after a name that follows a BOM by @seriallink in #187
- fix: skip fragments on unknown types when planning by @seriallink in #196
- fix: find a single value given for a list in ArgumentState by @seriallink in #198
- fix: build enum lookups without a data race by @seriallink in #199
- fix: report a nil pointer variable as null in ArgumentState by @seriallink in #201
- fix: leave the schema as it was when AppendType fails by @seriallink in #204
- fix: surface non-error Subscribe panics on the stream by @Beehtrix in #172
- fix: give extension hooks Background when Context is unset by @Beehtrix in #174
- fix: format non-error extension panics without re-panicking by @Beehtrix in #173
- fix: reject AppendType while another AppendType is in progress by @seriallink in #210
Documentation
- docs: add resolver ergonomics to the roadmap by @seriallink in #176
- docs: add the serving over HTTP guide by @seriallink in #168
- docs: note the root object of rejected mutations in the HTTP guide by @seriallink in #179
- docs: suggest allowing edits by maintainers on pull requests by @seriallink in #189
- docs: list union definitions without members in the migration guide by @seriallink in #186
- docs: mark the fixes since v0.13.0 for v0.14.0 by @seriallink in #192
- docs: state that API additions make a minor release by @seriallink in #193
- docs: add package comments by @seriallink in #214
- docs: add page descriptions and a descriptive site title by @seriallink in #215
- docs: say that ArgsAs converts no value through its methods by @seriallink in #212
Maintenance
- test: give TestDo_DeeplyNestedValues a margin under the race detector by @seriallink in #216
New Contributors
Full Changelog: v0.13.0...v0.14.0
v0.13.0
Metadata on schema elements. Applications can attach values of their own to types, fields, arguments and every other schema element, the equivalent of extensions in graphql-js (#11). Use it instead of encoding data in names or descriptions, which clients read through introspection.
-
Every config has a
Metadatafield, built withgraphql.NewMetadata(map[string]interface{}{...}): objects, interfaces, unions, enums and enum values, input objects and their fields, scalars, fields, arguments, directives and the schema. It is immutable, safe to share across goroutines, and not exposed in introspection. -
Resolvers reach it in one call:
p.Info.ReturnTypeMetadata()(the named return type, through lists and non-null),p.Info.FieldMetadata()andp.Info.FieldDefinition()(#171).graphql.MetadataValue[T]reads a value already converted toT:table, ok := graphql.MetadataValue[string](p.Info.ReturnTypeMetadata(), "table")
The name is Metadata because Extensions already means execution hooks here. Nothing changes for schemas without metadata; Schema and ResolveInfo are 8 bytes smaller. See Metadata in the guides.
Guides. The documentation site gained guides for subscriptions, validation, extensions, query plans and caching, and language tools, and a page on why the schema is built in code.
What's Changed
Features
- feat: add metadata to schema elements by @seriallink in #169
Documentation
- docs: add the latest open issues to the roadmap by @seriallink in #152
- docs: add the extensions guide by @seriallink in #147
- docs: add the subscriptions guide by @seriallink in #153
- docs: add the validation guide by @seriallink in #156
- docs: qualify cancellation and extension results in subscriptions by @seriallink in #154
- docs: add the query plans and caching guide by @seriallink in #158
- docs: add the language tools guide by @seriallink in #163
- docs: update the documentation roadmap item by @seriallink in #167
- docs: let security fixes change default behaviour by @seriallink in #170
Other changes
- docs: add the why code-first page by @seriallink in #159
- docs: sharpen the why code-first page by @seriallink in #166
Full Changelog: v0.12.2...v0.13.0
v0.12.2
What's Changed
Bug fixes
- fix(language): parse union types without members by @abhicodes-007 in #77
- fix: pass the ExecutionDidStart context to resolvers by @seriallink in #146
Documentation
- docs: add documentation to the roadmap by @seriallink in #124
- docs: bring the roadmap up to date with the open issues by @seriallink in #127
- docs: add the Resolvers section and the resolve functions guide by @seriallink in #128
- docs: add the default resolver guide by @seriallink in #134
- docs: add the context guide by @seriallink in #136
- docs: add the concurrent resolvers guide by @seriallink in #138
- docs: add the Execution section and the Do and Execute guide by @seriallink in #139
- docs: add the errors guide by @seriallink in #140
- docs: add the serialization guide by @seriallink in #141
New Contributors
- @abhicodes-007 made their first contribution in #77
Full Changelog: v0.12.1...v0.12.2
v0.12.1
What's Changed
Bug fixes
- fix: evaluate
@includeand@skipfor each selection, as collectFields does by @seriallink in #109
Documentation
- docs: add the directives guide by @seriallink in #106
Full Changelog: v0.12.0...v0.12.1
v0.12.0
Explicit null arguments. An explicit null can now reach a resolver, and a resolver can tell it apart from an omitted argument (#6):
- The
nullliteral is accepted, as in the specification, instead of being a syntax error. UnlessCoercionis enabled, a resolver receives an explicitnullas it receives an omitted value, soArgsare unchanged for every query that worked before. ResolveParams.ArgumentStatereports whether an argument, or a value inside it such asp.ArgumentState("input", "description"), was omitted, sent asnullor set. It works in every mode, even when aDefaultValuefills the argument. Use it to tell "clear this field" from "leave it unchanged".SchemaConfig.CoercioncontrolsResolveParams.Args:- Legacy (default):
Argsare unchanged. - Spec: coerces as the specification and
graphql-jsdo. An explicitnullstays inArgsasnil, including in an argument with aDefaultValueand inside input objects and lists. - Report: keeps the legacy
Argsand callsOnDifferencewherever spec mode would behave differently:null dropped,null defaulted,default appliedornull rejected.
- Legacy (default):
Spec mode puts nil in Args for an explicit null, so a single-value type assertion such as p.Args["limit"].(int) panics. If your resolvers rely on that pattern, stay in legacy mode and use ArgumentState where you need it. Otherwise, run report mode first and fix the resolvers it points to before switching to spec. See Null and omitted arguments.
This builds on earlier work in graphql-go/graphql by xxlv (graphql-go/graphql#696), mpenick (graphql-go/graphql#536), evulse (graphql-go/graphql#401) and chirino (graphql-go/graphql#631).
Result.ErrorsJoined combines the errors of a result into one error with errors.Join, and errors.Is and errors.As reach the errors returned by resolvers (#71).
Guides. The documentation site has a migration guide and guides for objects and fields, interfaces and unions, enums, input objects and custom scalars.
What's Changed
Features
- feat: add Result.ErrorsJoined by @asxxb in #85
- feat: support explicit null arguments by @seriallink in #100
Documentation
- docs: allow new cases in inherited table-driven tests by @seriallink in #90
- docs: add a documentation site built with Hugo and Hextra by @seriallink in #89
- docs: add the project logo and a richer home page to the site by @seriallink in #91
- docs: replace the site footer with a single compact row by @seriallink in #92
- docs: rewrite the documentation index and add a migration guide by @seriallink in #94
- docs: add the Schema section and the objects and fields guide by @seriallink in #95
- docs: add the interfaces and unions guide by @seriallink in #97
- docs: add the enums guide by @seriallink in #99
- docs: add the input objects guide by @seriallink in #103
- docs: add the custom scalars guide by @seriallink in #104
Maintenance
- ci: run the API check inside a Go workspace by @seriallink in #84
New Contributors
Full Changelog: v0.11.0...v0.12.0
v0.11.0
Serialization modes. A new SchemaConfig.Serialization option controls how values are serialized to the built-in scalars (Int, Float, String, Boolean, ID) and to enums (#7):
- Lenient (default): unchanged. Values that cannot be serialized still become
nullor are converted as well as possible, silently:"12.50"for anIntbecomes12, a validsql.NullInt64becomesnull. - Strict: serializes as the GraphQL specification and
graphql-jsdo. Values are unwrapped first (driver.Valuer; forStringandID,encoding.TextMarshalerandfmt.Stringer). A value with a valid serialization returns it, and a value without one becomes a field error, such asInt cannot represent non-integer value: "12.50". - Report: returns exactly the lenient result and calls
OnInvalidValuewherever strict mode would respond differently, with aKind:invalid(strict returns a field error) orcorrected(strict returns another value, inStrictResult).
Enabling strict mode can change responses that are accepted today: dates become RFC 3339, and values that come out as null or wrong in lenient mode return their value. Run report mode first, review the corrected and invalid events, and only then switch to strict. See the README.
What's Changed
Features
- feat: report or reject values that cannot be serialized by @seriallink in #83
Bug fixes
- fix: preserve schema block string descriptions by @cloudgpuapp in #81
Documentation
- docs: add a banner to the README by @seriallink in #80
Maintenance
- test: cover nested description round trips by @seriallink in #87
New Contributors
- @cloudgpuapp made their first contribution in #81
Full Changelog: v0.10.0...v0.11.0
v0.10.0
Requires Go 1.27 or newer. gql-go raised its minimum Go version from 1.21 to 1.27 (#5). There are no API or behaviour changes: code written for graphql-go v0.8.1 keeps compiling and behaving the same way. With the default GOTOOLCHAIN=auto, the go command downloads Go 1.27 when needed. If you cannot upgrade Go yet, stay on v0.9.x, which builds with Go 1.21 and receives security fixes until Go 1.27 reaches end of support, expected in August 2027.
What's Changed
Documentation
- docs: link roadmap items to their issues by @seriallink in #48
- docs: add a coverage badge by @seriallink in #49
- docs: link the code of conduct from CONTRIBUTING by @seriallink in #51
Maintenance
- ci: retry warming the Go proxy for up to an hour by @seriallink in #47
- ci: remind to announce minor releases by @seriallink in #50
- ci: release patches of older lines from release branches by @seriallink in #53
- chore: raise the minimum Go version to 1.27 by @seriallink in #52
- ci: scan supported release branches with govulncheck weekly by @seriallink in #55
Full Changelog: v0.9.1...v0.10.0
v0.9.1
Retracted versions. v0.4.18 to v0.8.1 are tags inherited from graphql-go/graphql and declare that module path. They are now retracted: go list -m -versions hides them and go get warns. For those versions, use github.com/graphql-go/graphql.
What's Changed
Bug fixes
- fix: build examples/httpdynamic on Windows by @seriallink in #4
Documentation
- docs: add contributor and agent guidelines by @seriallink in #1
Maintenance
- ci: add quality gates and a release workflow by @seriallink in #2
- chore: add LF checkouts, CODEOWNERS and a new CONTRIBUTING guide by @seriallink in #3
New Contributors
- @seriallink made their first contribution in #1
Full Changelog: v0.9.0...v0.9.1
v0.9.0
First release of github.com/gql-go/graphql, the community-maintained continuation of graphql-go/graphql.
It ships everything merged upstream since v0.8.1 (April 2023), which was never released, under the new module path.
Migrating
The API is unchanged. Replace the import prefix:
github.com/graphql-go/graphql -> github.com/gql-go/graphql
New
- Query plans and plan cache (graphql-go/graphql#740, @Nthalk):
PlanQuery,
ExecutePlanandPlanCacheprecompute the per-operation work (field
collection, field definition lookup, literal argument coercion, constant
@include/@skip) so a repeated operation only pays the per-request part.
PlanCacheis a bounded LRU with an optionalNormalizemode that lets
queries differing only in literal values share a plan.Executekeeps its
behaviour and now runs on top of the plan internally.
Fixes
- Abstract-field selections are planned lazily, avoiding an exponential blow-up
on deeply nested interfaces and unions (graphql-go/graphql#747, @patrikhermansson). - The overlapping-fields validation rule terminates on cyclic fragment spreads
(graphql-go/graphql#741, @mennatnaga). operationNamein thehttp-postexample (graphql-go/graphql#673, @qustavo).
Performance
- Faster
printer.Print(graphql-go/graphql#682, @adelsz).
Maintenance
- Unit test coverage raised to ~100% in the executor, definitions, introspection,
parser, printer and AST packages (graphql-go/graphql#732, #733, #734, #743-#746,
#748, #752, #753 upstream, @chris-ramon). - Small cleanups (graphql-go/graphql#684, @testwill; graphql-go/graphql#725, graphql-go/graphql#727).
- CI moved from CircleCI to GitHub Actions, testing Go 1.21 and the latest
stable release with the race detector.
Thanks
To @chris-ramon and @sogko for creating and maintaining graphql-go/graphql, and to everyone whose work is in this release.