Input & Output Types
GraphQL makes a clear distinction between input and output types. Input types are concerned with the arguments to our resolvers, and output types are concerned with what we return from our resolvers. Certain types such as scalars can appear both as an input or an output type. However, many input and output types are mutually exclusive.
Neutral Types
All scalars, enums, and lists of neutral types fall under this category. For example:
String
Float!
enum Membership { free, paid, enterprise }
[String]
[Membership!]
Output Types
All neutral types, objects, unions, interfaces, and lists of output types fall under this category. The fields of an object type may only be other output types. For example:
String
enum Membership { free, paid, enterprise }
type User { id: ID!, membership: Membership! }
[User]
Input Types
All neutral types, input objects and lists of input types fall under this category. The fields of an input object
type may only be other input types
String
enum Membership { free, paid, enterprise }
input SignupArgs { fullName: String!, membership: Membership! }
In uniform-graphql
, the type system will guide you and make sure that you don’t accidentally mix input types and output types.