requireNullableFieldsWithOneof
| Property | Value |
|---|---|
| Config name | requireNullableFieldsWithOneof |
| Default severity | — |
| Context | Schema |
| In recommended | No |
What it checks
Section titled “What it checks”Requires all fields in @oneOf input types to be nullable. The @oneOf directive indicates that exactly one field must be provided, so all fields must be optional (nullable). A non-null field would prevent valid @oneOf usage since the caller could never omit it.
Examples
Section titled “Examples”# ❌ Bad — non-null fields in @oneOf input typeinput UserByInput @oneOf { id: ID! email: String!}# ✅ Good — all fields are nullableinput UserByInput @oneOf { id: ID email: String username: String}Configuration
Section titled “Configuration”extensions: graphql-analyzer: lint: rules: requireNullableFieldsWithOneof: error