Scalar types are the basic data types (e.g., Ints, Floats, etc.) used to define fields in objects. They represent the leaves of a GraphQL query (because they are not objects themselves) 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 re-fetch 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.
- RFC 3339 is a standard for date and time representation.
full-date
is specified as having the formatdate-fullyear "-" date-month "-" date-mday
.
- DateTime: Date and time serialized as an RFC-3339 quoted string. It differs from
Date
in that its format isfull-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 revealing 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 this:
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.