February 2020
Intermediate to advanced
404 pages
8h 42m
English
Enumerations (Enums) are special types that give flexibility in defining a range of scalar types. They can be helpful for passing a range of information to the client. It brings the following benefits to an API:
Let's take a look at an example schema:
type Query { vehicle: Vehicle}enum Vehicle { Car Bus}type Car { name: String, wheels: Int}type Bus { name: String, wheels: Int}
In this GraphQL schema, we have a query type defined with vehicle as a field. Vehicle is an Enum. The vehicle has Car and Bus as its members. This means the query to this schema can ...
Read now
Unlock full access