With-Input plugin
A plugin for creating fields with a single input object. This plugin adds a new t.fieldWithInput
method that allows you to more easily define fields with a single input type without having to
define it separately.
Usage
Install
Setup
Defining fields with inputs
This will produce a schema like:
The input name will default to ${ParentType.name}${Field.name}Input
.
Customizing your input object
You can customize the name of your Input object, and the name of the input argument:
Changing the nullability of the input arg
You can configure the global default for input args when creating the builder by providing
WithInputArgRequired
in the builders SchemaTypes
, and setting withInput.argOptions.required
.
arg requiredness can also be set on a per field basis by setting argOptions.required
Prisma plugin integration
If you are using the prisma plugin you can use t.prismaFieldWithInput
to add prisma fields with
input objects:
Customizing the default naming conventions
If you want to customize how the default input type names are generated you can provide a name
callback in withInput.typeOptions
: