Schema Generation

Documentation for Umbraco Heartcore GraphQL schema generation

The GraphQL schema is generated from the Content Types upon creation, and it is generated when a Content Type or a Data Type is changed.

The type name is the Content Type's alias in Pascal Case, e.g. if a Content Type has an alias of product it's GraphQL type name would be Product.

Table of Contents

Types

The types generated depends on how the Content Types are configured.

If a Content Type is inherited from or used as a Composition it will be generated as an interface

interface NavigationBase {
  seoMetaDescription: String
  umbracoNavihide: Boolean
}

If the Document Type is marked as an Element Type it will implement the Element interface

All other Content Types will implement either the Content or the Media interface, they will also implement all their Composition interfaces.

A Connection and an Edge type will also be generated, these are used when quering Content of a specific type.

Fields

All properties on a Content Type is generated as a field on the GraphQL type. See the Property Editors page for which types the editors are returning.

If a property is marked as Allow varying by culture, a culture argument is added to that field. The argument is optional and will fallback to the parent fields culture or the default culture if none is specified.

Root Query

The Query type is the entry to the GraphQL API. By default it contains two fields, one to get a single Content item by ID or url and one to get all Content.

For each Document Type that is not used as a Composition or marked as an Element Type, two fields will be generated on the Query type. One for getting a single Content item by either it's ID or url and a field for getting all Content of that specific type.

Reserved Type Names and Property Aliases

GraphQL requires that type names are unique. If a Content Type will collide with one of the reserved names the type will be excluded from generation.

The same applies to Properties. If a Property alias is a reserved one it will also be excluded from generation.

Reserved Type Names

List of reserved type names, these cannot be used as an alias for Content Types.

The GraphQL type name is the Content Type alias converted to Pascal Case.

  • BigInt

  • BlockGrid

  • BlockGridArea

  • BlockGridItem

  • BlockListItem

  • Byte

  • Content

  • Date

  • DateTime

  • DateTimeOffset

  • Decimal

  • DecimalRange

  • Element

  • Guid

  • HTML

  • ImageCropAnchor

  • ImageCropFormat

  • ImageCropMode

  • ImageCropper

  • ImageCropperCrop

  • ImageCropperCropCoordinates

  • ImageCropperFocalPoint

  • ImageCropRatioMode

  • JSON

  • Link

  • LinkType

  • Long

  • Media

  • MediaConnection

  • MediaEdge

  • Milliseconds

  • OurUmbracoGMaps

  • OurUmbracoGMapsAddress

  • OurUmbracoGMapsCoordinate

  • OurUmbracoGMapsMapConfig

  • OurUmbracoGMapsMapType

  • PageInfo

  • PickedColor

  • Query

  • SByte

  • Seconds

  • Short

  • UInt

  • ULong

  • Uri

  • UShort

Reserved Element Type Property Names

List of reserved Element Type Property names, these cannot be used as a Property alias on an Element Type.

  • contentTypeAlias

Reserved Content Type Property Names

List of reserved Content Type Property names, these cannot be used as a Property alias on a Content Type.

  • ancestors

  • children

  • contentTypeAlias

  • createDate

  • descendants

  • id

  • level

  • name

  • parent

  • content

  • parentId

  • sortOrder

  • updateDate

  • url

Reserved Media Type Property Names

List of reserved Media Type Property names, these cannot be used as a Property alias on a Media Type.

  • ancestors

  • children

  • createDate

  • descendants

  • id

  • level

  • mediaTypeAlias

  • name

  • parent

  • sortOrder

  • updateDate

  • url

Built-in Custom Types

The Umbraco Heartcore GraphQL schema contains some default types, below you can find a list of these types.

The Property Editors page contains a list of all the Property Editors and which GraphQL types they return.

Block Grid

Query

Output

Block Grid Area

Query

Output

Block Grid Item

Query

Output

Block List Item

Query

Output:

Decimal Range

Query:

Output:

HTML

Query:

Output:

Image Cropper

Query:

Output:

Image Crop Anchor

Query:

Output:

Image Crop Format

Query:

Output:

Image Crop Mode

Query:

Output:

Image Crop Ratio Mode

Query:

Output:

Image Cropper Crop

Query:

Output:

Image Cropper Crop Coordinates

Query:

Output:

Image Cropper Focal Point

Query:

Output:

JSON

Query:

Output:

Query:

Output:

Query:

Output:

Media With Crops

Query:

Output:

Our Umbraco GMaps

Query:

Output:

Our Umbraco GMaps Address

Query:

Output:

Our Umbraco GMaps Config

Query:

Output:

Our Umbraco GMaps Coordinate

Query:

Output:

Our Umbraco GMaps Map Type

Page Info

Query:

Output:

Picked Color

Query:

Output:

Element

Query:

Output:

Content

Content Connection

Content Edge

Media

Media Connection

Media Edge

Filtering

For all Document Types a FilterInput type is generated. The name is the type name postfixed by FilterInput e.g. given a type named Product the name will be ProductFilterInput.

Default Filter Fields

To filter the allContent field, ancestors, children and descendants connections the ContentFilterInput is used.

All filter inputs for Content Types will also have the default fields.

Filtering is possible only on non-complex Property Editors like Text Area and Label. Filtering on more complex types like Content Picker and Multi-node Tree Picker has to be done client-side.

Strings

For fields returning String the following filter fields are generated.

Given the following type:

The following type will be generated, incl. the fields from the ContentFilterInput.

Ints

For fields returning Int or Decimal the following filters are generated.

The type is either Int or Decimal depending on the output type.

Given the following type:

The following type will be generated, incl. the fields from the ContentFilterInput.

Boolean

For types returning Boolean the following filters are generated.

Given the following type:

The following type will be generated, incl. the fields from the ContentFilterInput.

Content

For types returning Content the ContentFilterInput is used.

Dates

For types returning DateTime the following filters are generated.

Given the following type:

The following type will be generated, incl. the fields from the ContentFilterInput.

Media

For types returning Media the MediaFilterInput is used.

Lists

For types returning [Decimal], [Int] or [String] the following filters are generated.

The type is [Decimal], [Int] or [String] depending on the output type

Given the following type:

The following type will be generated, incl. the fields from the ContentFilterInput.

Ordering

The result can be ordered by specifying a value for the orderBy argument.

An OrderBy type is generated for all Document Types. The name is the type name postfixed by OrderByInput e.g. given a type named Product the name will be ProductOrderByInput.

Fields returning DateTime, Decimal, Boolean, Int or String can be used to order by.

Default OrderBy Fields

To filter the allContent field, ancestors, children and descendants connections the ContentOrderBy is used.

All order by inputs for Content Types will also have the default fields.

The following type will be generated, incl. the fields from the ContentOrderByInput.

Default ordering

If you don't specify any order the data returned will be ordered by the path they appear in, in the Umbraco Backoffice tree.

Last updated

Was this helpful?