📄️ GraphQL Schema Types
The GraphQL language provides multiple types for representing your exposed API and the required data structures for the input values. In the following sections we explain their usage within Leto and, in general, for GraphQL. Each section contains a link to the official GraphQL specification for more information.
📄️ Scalars
The fundamental building-block in the type system. Standard GraphQLScalarTypes: String, Int, Float, Boolean and ID types are already implemented and provided by Leto.
📄️ Enums
Enums are text values which are restricted to a set of predefined variants. Their behavior is similar to scalars and they don't have a nested fields.
📄️ Objects
GraphQL objects allow you to specify a type with a set of fields or properties. Objects can only be outputs in a resolver. Each field can be of any output type.
📄️ Inputs and Input Objects
Input types specify the structure of the values that inputs to resolvers should have. Scalars and Enums can be passed as input to resolvers. Wrapper types such as List and NonNull types of Scalars and Enums, also can be passed, however for more complex Objects with nested fields you will need to use GraphQLInputObjectType. Similar GraphQLObjectType, a GraphQLInputObjectType can have fields.
📄️ Unions
Similar to enums, Unions are restricted to a set of predefined variants, however the possible types are always the more complex GraphQLObjectType.
📄️ Wrapping Types
Wrapping types allow to modify the behavior of the inner (wrapped) type. The inner types can be of any GraphQLType and wrapping types can be Output or Input Types if the wrapped type is an Output or Input type. GraphQL has two wrapping types, GraphQLNonNullType and GraphQLListType.
📄️ Non-Nullable
GraphQLNonNullType allows you to represent a non-nullable or required value. By default, all GraphQL Types are nullable or optional, if you want to represent a required input or specify that a given output is always present (non-null), you want to use the GraphQLNonNullType wrapping type.
📄️ Lists
GraphQLListType allows you to represent a collection of values.
📄️ Abstract Types
Abstract types like Interfaces and Unions, require type resolution of its variants on execution. For that, we provide a couple of tools explained in the following sections. You can read the code that executes the following logic in package:leto's GraphQL.resolveAbstractType method.
📄️ Advanced Types
Provided Types