input-type-suffix

Since 0.9.0 · In the rulesets: Recommended at warning, Strict at error, All at error

This rule checks that input object type names end with a suffix, Input by default.

Rule details

The suffix tells input types from the output types they often mirror, e.g. User and UserInput. Type extensions are not checked.

The rule applies to definitions. An # apigenie-lint-disable input-type-suffix comment on a node turns it off for the node and everything nested in it; at the top of the file, separated from the first definition by a blank line, the comment turns it off for the whole file.

Configuration

The configuration block can be a string, the suffix, or an object with the suffix property. The suffix cannot be empty.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        input-type-suffix: [warning, Params]

Examples

Good.

input CreateUserInput { name: String }

Bad. The linter reports Input object type 'CreateUser' should end with 'Input'.

input CreateUser { name: String }

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.graphql has the details.

commands:
  lint:
    graphql:
      rules:
        input-type-suffix: off

Related rules

Last updated on View as Markdown
Was this helpful?