github 99designs/gqlgen v0.17.94

6 hours ago

Upcoming Potentially Breaking Changes Warning

This release has changes in the Federation plugin, introducing opt-in changes that will become the default in the next release (v0.17.95).

When configured, the federation plugin creates an entity resolver that accepts a list of representations, improving performance by reducing the number of individual resolver calls.

// IMPORTANT: The output slice order is critical and must match the input slice order exactly!
func (r *entityResolver) FindUserByIDs(ctx context.Context, reps []*entity.UserByIDsInput) ([]*model.User, error) {
	output := make([]*model.User, len(reps))
	for i, user := range reps {
		output[i] = &model.User{
			ID:   user.ID,
			Name: "User " + user.ID,
		}
	}

	return output, nil
}

The @entityResolver directive enables optimization for entity resolver generation in GraphQL federation, and can be opted in by specifying multi: true as in:

type MultiHello @key(fields: "name") @entityResolver(multi: true)

Or you can enable this feature by default by setting the federation.options.entity_resolver_multi flag in your configuration:

federation:
  filename: graph/federation.go
  package: graph
  version: 2
  options:
    entity_resolver_multi: true

What's Changed

New Contributors

Full Changelog: v0.17.93...v0.17.94

Don't miss a new gqlgen release

NewReleases is sending notifications on new releases.