# no-scalar-result-on-mutation

Source: https://apigenie.pl/docs/linter/graphql/rules/no-scalar-result-on-mutation

This rule checks that mutation fields return object types rather than scalars.

## Rule Details

A payload object can grow, e.g. with the changed objects or with errors, while a scalar result can only be replaced by a breaking change.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        no-scalar-result-on-mutation: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable no-scalar-result-on-mutation` comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.

## Examples

**Good**.

```graphql
type Mutation { logout: LogoutPayload }
type LogoutPayload { success: Boolean }
```

**Bad**. The linter reports `Field 'Mutation.logout' should return an object type rather than the scalar 'Boolean'`.

```graphql
type Mutation { logout: Boolean }
```
