API

args

args

GraphQL Docs on Arguments

arg, intArg, stringArg, floatArg, idArg, booleanArg

Defines an argument that can be used in any object or interface type. Args can be reused in multiple locations, and it can be convenient to create your own wrappers around arguments.

1import { intArg, core } from 'nexus'
2
3function requiredInt(opts: core.ScalarArgConfig<number>) {
4 return nonNull(intArg({ ...opts }))
5}

Common options available for arg include the following:

Description

The description to annotate the GraphQL SDL

Format: description?: string;

Default

The default value for an argument

Example: intArg({ default: 1 })

Edit this page on Github
Content