github graphql-compose/graphql-compose v5.6.0

latest releases: v9.0.10, v9.0.9, v9.0.8...
5 years ago

5.6.0 (2019-01-31)

Features

  • add UnionTypeComposer helper (880eecf)

The most useful method is addTypeResolver – it helps to add a Type to Union and also provide a function which will verify compliance of js object to provided GraphQL type:

const utc = new UnionTypeComposer('MyUnion');
PersonTC = TypeComposer.create(`
  type Person { age: Int, field1: String, field2: String }
`);
utc.addTypeResolver(PersonTC, value => {
  return value.hasOwnProperty('age');
});

KindRedTC = TypeComposer.create(`
  type KindRed { kind: String, field1: String, field2: String, red: String }
`);
utc.addTypeResolver(KindRedTC, value => {
  return value.kind === 'red';
});

Don't miss a new graphql-compose release

NewReleases is sending notifications on new releases.