Repository navigation
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