Skip to main content

Types

Types are the building blocks of a GraphQL schema.

Each type represents a specific kind of data, such as objects, scalars, or enums.

  • Objects: Composite types that can contain fields, representing related data.
  • Scalars: Atomic types like Int, String, and Boolean, representing simple values.
  • Enums: Defines a set of possible values for a field.

Queries, mutations, and all of their inputs are strongly typed, making the schema not only possible but clean.

You can query every type in Swan's schema using GraphQL's built-in introspection.

Schema query
query {
__schema {
types {
name
description
}
}
}
Payload
{
"data": {
"__schema": {
"types": [
{
"name": "Account",
"description": "Whether you call it a wallet, monetary account, payment account or bank account, the notion of account is fundamental at Swan. All payment flows necessarily go through an account."
},
{
"name": "ID",
"description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID."
},
{
"name": "String",
"description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text."
},
{
"name": "Boolean",
"description": "The `Boolean` scalar type represents `true` or `false`."
},
{
"name": "Int",
"description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1."
},

{...} //response contains thousands of lines

]
}
}
}