-
Notifications
You must be signed in to change notification settings - Fork 15
How It Works
The GraphQL Schema is the graphical representation of the domain that will be exposed by GraphQL for query
and mutation
Operations. It's worth noting that, while this is how data is exposed, it need not be how it is persisted. This decoupling is one of the major advantages of GraphQL.
The GLiTR type registry is really the foundational element of the library. The type registry is a map of Java Classes to GraphQLType
. It uses reflection to analyze the domain (starting with the Object passed to the withQueryRoot
method when building a new Glitr
Object using GlitrBuilder
).
Each domain class is inspected and methods starting with get
or is
are registered in the schema.
CompositeDataFetcher: Chain of Responsibility pattern for the servicing of a field resolve, the CompositeDataFetcher
will pass a request along a sequential list of DataFetchers until it is handled. This implementation allows one or more DataFetchers to serve as a backup (e.g. if the element isn't found try this other DataFetcher that fetches from another source) as well as creates a more lenient system if if multiple ways of fetching have been defined but only one was intended such as when an Annotation is present for which there is an Annotation based DataFetcher defined and the developer seeks to override it's behavior without removing the Annotation.
OverrideDataFetcher: Overrides whatever default data fetcher was provided. See Override data fetcher outside the schema definition class.
RelayMutationDataFetcher: DataFetcher used when GraphQL operation is a relay mutation.
BatchedCompositeDataFetcher: The only difference with CompositeDataFetcher
is it implements the BatchedDataFetcher
interface to be picked up by the BatchedExecutionStrategy
.
@GlitrArgument: Identifies and defines the GraphQL arguments available for a given field. These are what can be used when querying said field.
@GlitrArguments: A container for the @GlitrArgument
annotation, allowing multiple arguments for a given field.
@GlitrDescription: Allows for a string description that'll be exposed in the GraphQL schema. This is a great way to describe and document right from the code.
@GlitrForwardPagingArguments: Enables paging for given field, exposing Connection
type and pageInfo
attribute to clients.
@GlitrIgnore: Marks a field to be ignored during schema creation. Useful for internal variables that shouldn't litter the schema.
@GlitrNonNull: Denotes a field that is not optional.
Copyright 2016 NFL Enterprises LLC.
NFL Engineers blog | Twitter @nflengineers | Jobs