Schema
A wrapper around a schema GQLDocument that ensures the GQLDocument is valid and caches some extra information. In particular, Schema:
always contain builtin definitions (SDL can omit them)
always has a schema definition for easier lookup of root operation types
has all type system extensions merged
has some helper functions to retrieve a type by name and/or possible types
caches keyFields for easier lookup during codegen
remembers foreignNames to keep track of renamed definitions
remembers directivesToStrip to keep track of client-only directives
Parameters
a list of validated and merged definitions
a Map containing the key fields for each type
a Map from a type system name -> its original name in the foreign schema. To distinguish between directives and types, directive names must be prefixed by '@' Example: "@kotlin_labs_nonnull" -> "@nonnull"
directives to strip because they are coming from a foreign schema Example: "kotlin_labs_nonnull"
Constructors
Creates a new Schema from a list of definition. This doesn't support foreign schemas.
Types
Functions
Returns whether the typePolicy
directive is present on at least one object in the schema
List all types (types, interfaces, unions) implemented by a given type (including itself)
returns all possible types:
return whether the given directive should be removed from operation documents before being sent to the server
List all direct super types (interfaces, unions) implemented by a given object type