github graphql-compose/graphql-compose v7.5.0

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

7.5.0 (2019-11-21)

Features

  • add toSDL({ deep: boolean }) method to all TypeComposers (5eee54e), related #214
  • add getNestedTCs() which return all used types for any ObjectType (5eee54e)

This feature is preparation for Apollo Federation support #214
Also toSDL() method is very useful for testing purposes (eg in snapshots).

Suppose we have the following Schema:

type User implements I1 & I2 {
  f1: String
  f2: Int
  f3: User
  f4(f: Filter): Boolean 
}

input Filter { a: Int b: Filter }

interface I1 { f1: String }
interface I2 { f2: Int }

type AnotherType1 { a: Int }

Then the following code will return:

UserTC.toSDL();
// or
schemaComposer.getTypeSDL('User');
type User implements I1 & I2 {
  f1: String
  f2: Int
  f3: User
  f4(f: Filter): Boolean
}

Even more, you may obtain SDL for any type with all dependent sub-types:

UserTC.toSDL({ deep: true });
// or
schemaComposer.getTypeSDL('User', { deep: true });

Take a look that AnotherType1 is not present in the output, cause it not used by User type or its dependents:

type User implements I1 & I2 {
  f1: String
  f2: Int
  f3: User
  f4(f: Filter): Boolean
}
scalar String
scalar Int
scalar Boolean
input Filter { a: Int b: Filter }
interface I1 { f1: String }
interface I2 { f2: Int }

Don't miss a new graphql-compose release

NewReleases is sending notifications on new releases.