GraphQL schema

A schema describes how data is organized and structured. It defines a hierarchy of types with fields that are populated from the content. The schema also specifies exactly which queries are available for clients to execute against the data graph.

Important

The Preview API and Delivery API do not support mutations.

Note

The ComplexityLimit for both the Preview and Delivery APIs is 250.

You can use GraphQL to verify the data types available by querying the __schema field. The __schema field is always available on the root type of a query.

To display all the types that are present in the schema, run the following command:

RequestResponse

{
 __schema {
  types {
   name
  }
 }
}

You can also access the schema from the SCHEMA tab on the right-hand side of the GraphQL IDE. You can download the schema by clicking the DOWNLOAD button on the SCHEMA tab.

Note

Most GraphQL IDEs perfrom an introspection query over the schema to provide additional tools to the developer (such as autocomplete and to show information about the schema).

Types

The GraphQL types show how entity definitions are mapped in GraphQL. The types available depend on the schema.

Note

When you create a content type, it is the content type ID (not the content type name) that is synchronized with the GraphQL schema; however, in GraphQL, the ID is given an initial capital. For example, a content type with the ID article in Content Hub ONE becomes Article in GraphQL.

Scalar types

Scalar types are basic data types that always resolve to concrete data. Sitecore Content Hub ONE includes the following default scalar types.

Scalar type

Description

Int

A signed 32‐bit integer.

Float

A signed double-precision floating-point value.

String

A UTF‐8 character sequence.

Boolean

A true or false value.

ID (serialized as a string)

A unique identifier used to fetch an object, or used as a key for a cache. Although it is serialized as a string, an ID is not intended to be human‐readable.

Content Hub ONE also includes the following custom scalar types:

Scalar type

Description

MultiplierPath

Represents a valid GraphQL multiplier path string.

DateTime

Provides the date time in 2021-01-19T17:33:00.000Z format.

Long

Provides extended capacity for storing exceptionally large numbers.

Decimal

Decimal variables are stored as 96-bit (12-byte) unsigned integers, together with a scaling factor and a value indicating whether the decimal number is positive or negative.

Object types

Most of the types you define in a GraphQL schema are object types. An object type contains fields, each of which can be either a scalar type or another object type. For Content Hub ONE, there are several types in the GraphQL schema for each publishable entity definition. You can list the types generated: a singular query type, an “all” query type, a predicate type for writing “where” clauses, or a single return type. The fields of these types are generated based on the field of the entity definition. The DOCS tab in the IDE contains more information about object types.

Do you have some feedback for us?

If you have suggestions for improving this article,