# no-root-type

Source: https://apigenie.pl/docs/linter/graphql/rules/no-root-type

This rule checks that the schema doesn't have the root operation types the configuration disallows.

## Rule Details

Some APIs are read-only, or don't support subscriptions. The rule reports the disallowed root operation types; with the default configuration it reports nothing.

## Configuration

The configuration block is an object with the `disallow` property: a list of `mutation`
and `subscription`.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        no-root-type: [error, { disallow: [mutation, subscription] }]
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable no-root-type` 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 Query { me: User }
```

**Bad**. With the options `{ disallow: [mutation] }`, the linter reports `The schema should not have a mutation root operation type ('Mutation')`.

```graphql
type Query { me: User }
type Mutation { logout: Boolean }
```
