Graphql Schema Cheat Sheet



Try these examples on the Demo GraphQL Playground

Simple Hits#

Graphql-java: The alpha and omega of any project, the GraphQL Java implementation itself. Graphql-java-tools: The library that allows you to use the GraphQL schema language to build your GraphQL schema. It's inspired by Apollo's graphql-tools, it parses the given GraphQL schema and allows you to bring your own object to fill in the implementations. Creates a GraphQLSchema object from GraphQL schema language. The schema will use default resolvers. For more detail on the GraphQL schema language, see the schema language docs or this schema language cheat sheet. Try these examples on the Demo GraphQL Playground. Used for facet interactions such as for search or for when displaying more facet options.

results {
items {
id
title
}
Graphql schema example
}
}

Hit Querying#

results(query:'heat'){
items {
id
title
}
}
}

Hit Filtering#

results(
{identifier:'type',value:'Movie'},
{identifier:'dateExample',dateMin:'2020-12-01T00:00:00.000Z',dateMax:'2020-12-11T00:00:00.000Z'}
){
items {
}
}

Facet list#

results {
identifier
display <-- Used by client onhow to display the facet. Can be configured in Facet configuration
entries{
label
}
}

Single Facet#

Used for facet interactions such as for search or for when displaying more facet options.

results {
identifier:'actors',
size:20 <--- size options onfacet
identifier
type
entries {
label
}
}

Pagination#

results {
page:{from:100,size:100} <-- used to control page
items {
}
total
pageNumber
size
}
}

Sorting Results#

results {
sortOptions { <--- all available sort options
label
}
sortBy:'<id>' <--- Wish to sort by, the sort id
sortedBy <--- the selected sort, the sort id
}

Filter Summary#

results {
query <-- the query value
appliedFilters { <-- array of filters applied to search
identifier
label
dateMin
}
..onNumericRangeSelectedFilter{
max

Graphql Schema Query

value
}
hits(page:{from:100,size:0}){
id
}
}

The graphql/utilities module contains common useful computations to use withthe GraphQL language and type objects. You can import either from the graphql/utilities module, or from the root graphql module. For example:

Overview#

Introspection

Schema Language

Visitors

Value Validation

Introspection#

introspectionQuery#

A GraphQL query that queries a server's introspection system for enoughinformation to reproduce that server's type system.

buildClientSchema#

Build a GraphQLSchema for use by client tools.

Given the result of a client running the introspection query, creates andreturns a GraphQLSchema instance which can be then used with all GraphQL.jstools, but cannot be used to execute a query, as introspection does notrepresent the 'resolver', 'parse' or 'serialize' functions or any otherserver-internal mechanisms.

Schema Representation#

buildSchema#

Creates a GraphQLSchema object from GraphQL schema language. The schema will use default resolvers. For more detail on the GraphQL schema language, see the schema language docs or this schema language cheat sheet.

Graphql schema definition

printSchema#

Prints the provided schema in the Schema Language format.

printIntrospectionSchema#

Prints the built-in introspection schema in the Schema Language format. Pages for mac icon.

buildASTSchema#

This takes the ast of a schema document produced by parseSchemaIntoAST ingraphql/language/schema and constructs a GraphQLSchema instance which can bethen used with all GraphQL.js tools, but cannot be used to execute a query, asintrospection does not represent the 'resolver', 'parse' or 'serialize'functions or any other server-internal mechanisms.

typeFromAST#

Given the name of a Type as it appears in a GraphQL AST and a Schema, return thecorresponding GraphQLType from that schema.

Graphql Schema Cheat Sheet Example

astFromValue#

Produces a GraphQL Input Value AST given a JavaScript value.

Optionally, a GraphQL type may be provided, which will be used todisambiguate between value primitives.

Visitors#

TypeInfo#

TypeInfo is a utility class which, given a GraphQL schema, can keep trackof the current field and type definitions at any point in a GraphQL documentAST during a recursive descent by calling enter(node) and leave(node).

Graphql Schema Cheat Sheet Excel

Value Validation#

isValidJSValue#

Given a JavaScript value and a GraphQL type, determine if the value will beaccepted for that type. Linux for ppc mac os. This is primarily useful for validating theruntime values of query variables. Httrack for mac.

isValidLiteralValue#

Utility for validators which determines if a value literal AST is valid givenan input type.

Create Graphql Schema

Note that this only validates literal values, variables are assumed toprovide values of the correct type.