# oneof-fields-nullable

Source: https://apigenie.pl/docs/linter/graphql/rules/oneof-fields-nullable

This rule checks that the fields of `@oneOf` input object types are nullable and have no default value.

## Rule Details

Exactly one field of a `@oneOf` input object is given; a non-null field or a default value would make every value invalid, as the specification of `@oneOf` requires.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        oneof-fields-nullable: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable oneof-fields-nullable` 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
input UserBy @oneOf { id: ID, email: String }
```

**Bad**. The linter reports `Input field 'UserBy.id' of the @oneOf input object type should be nullable`.

```graphql
input UserBy @oneOf { id: ID!, email: String }
```
