StepZen's Custom Scalars

The additional scalar types built into StepZen's system.

As defined by GraphQL.org, scalar types represent the leaves of a GraphQL query and enable the query fields to resolve to concrete data.

This topic lists the Scalar Types available in StepZen:

Built-in GraphQL Scalar Types

GraphQL has the following built-in scalar types:

  • Int: Signed 32‐bit integer.
  • Float: Signed double-precision, floating-point value.
  • String: UTF‐8 character sequence.
  • Boolean: True or false.
  • ID: Unique identifier, often used to refetch an object or as the key for a cache. The ID type is serialized in the same way as a String; however, defining it as an ID signifies that it is not intended to be human‐readable.

Custom StepZen Scalar Types

Available Types

StepZen provides the following custom scalar types:

  • Date: A date that is serialized as an RFC-3339 (section-5.6) full-date quoted string.
  • DateTime: Date and time serialized as an RFC-3339 quoted string. It differs from Date in that its format is full-date "T" full-time
  • JSON: Arbitrary JSON value that can be a value, array, or object.
  • Secret: String used as an argument type, representing a secret such as an API key or token. A value is serialized as ******** in any GraphQL response, to avoid any leakage of secrets.

Use StepZen's Custom Scalar Types

You can implement these types just as you would GraphQL's built-in types, inside your type definition like so:

type Tracking {
  origin: String!
  weight_lbs: Int
  dateDelivered: DateTime
  dateReceived: Date
  finalAddress: JSON
}

In this example, the fields dateDelivered, dateReceived, and finalAddress (which use StepZen's DateTime, Date, and JSON types), are available for you to use in your queries.

This site uses cookies: By using this website, you consent to our use of cookies in accordance with our Website Terms of Use and Cookie Policy.