Skip to content

v0.13.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 01:35
· 46 commits to master since this release
32491fd

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 Metadata field, built with graphql.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() and p.Info.FieldDefinition() (#171). graphql.MetadataValue[T] reads a value already converted to T:

    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

Documentation

Other changes

Full Changelog: v0.12.2...v0.13.0