As the name suggests, field-level types are defined on a resource/query field. They are similar to the types in a programming language. It tells us what data type is going to be returned from the API. It can be further divided into two types:
- Scalar types (String, Int, Float, Boolean, ID)
- Custom types (Address)
In the previous example, the Person object-level type has the following fields:
- name
- address
The Go struct for the Person resource looks like this:
type Person {
name: String,
address: [Address]
}
The name field has a type called String, while the address field has a type called [Address], which is a list of addresses.