Skip to content

useInputName (GraphQL)

Language GraphQL
biome.json
{
"linter": {
"rules": {
"style": {
"useInputName": "error"
}
}
}
}

Require mutation arguments to be named input.

A consistent argument name makes mutations predictable for schema users and client tools.

type Mutation {
SetMessage(message: InputMessage): String
}
code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Unexpected input name, expected the input name "message" to be named "input".

1 │ type Mutation {
> 2 │ SetMessage(message: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^^^
3 │ }
4 │

ℹ Using the same name for all input parameters will make your schemas easier to consume and more predictable.

type Mutation {
SetMessage(input: SetMessageInput): String
}

Optionally requires the input type to be named <mutation name>Input, so schema readers can identify its related mutation.

  • "off" does not check the type name;
  • "loose" checks the name without regard to letter case;
  • "strict" requires matching letter case.

Defaults to "off".

biome.json
{
"linter": {
"rules": {
"style": {
"useInputName": {
"level": "on",
"options": {
"checkInputType": "loose"
}
}
}
}
}
}
type Mutation {
SetMessage(input: InputMessage): String
}
code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Unexpected input type name, expected the input type name "InputMessage" to be named "SetMessageInput".

1 │ type Mutation {
> 2 │ SetMessage(input: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^
3 │ }
4 │

ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.

type Mutation {
SetMessage(input: setMessageInput): String
}
type Mutation {
SetMessage(input: SetMessageInput): String
}
biome.json
{
"linter": {
"rules": {
"style": {
"useInputName": {
"level": "on",
"options": {
"checkInputType": "strict"
}
}
}
}
}
}
type Mutation {
SetMessage(input: InputMessage): String
}
code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Unexpected input type name, expected the input type name "InputMessage" to be named "SetMessageInput".

1 │ type Mutation {
> 2 │ SetMessage(input: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^
3 │ }
4 │

ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.

type Mutation {
SetMessage(input: setMessageInput): String
}
code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Unexpected input type name, expected the input type name "setMessageInput" to be named "SetMessageInput".

1 │ type Mutation {
> 2 │ SetMessage(input: setMessageInput): String
│ ^^^^^^^^^^^^^^^^^^^^^^
3 │ }
4 │

ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.

type Mutation {
SetMessage(input: SetMessageInput): String
}