graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.94k stars 841 forks source link

Support thunks for Union.Types definitions #622

Closed alex-lange closed 2 years ago

alex-lange commented 2 years ago

In schemas, it is possible to define the Union type before the definitions of the object types that are part of the union. This change adds a "UnionTypesThunk" option when creating a new Union, similar to the existing FieldsThunk and InterfacesThunk.

This more closely matches the interface in graphql-js: https://github.com/graphql/graphql-js/blob/47bd8c8897c72d3efc17ecb1599a95cee6bac5e8/src/type/definition.ts#L1307

It is a first step in closing out https://github.com/graphql-go/graphql/issues/624

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.008%) to 91.983% when pulling 0e40a4e01faa4d0f8cf36bf0ef64ff5965894df6 on alex-lange:lange-add-union-thunk into f02a1c961028d3ba7ac6bb22eaa09b31a2cb53dd on graphql-go:master.