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