Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Rulesrequire-type-pattern-with-oneof

require-type-pattern-with-oneof

  • Category: Schema
  • Rule name: @graphql-eslint/require-type-pattern-with-oneof
  • Requires GraphQL Schema: false ℹ️
  • Requires GraphQL Operations: false ℹ️
Enforce types with `@oneOf` directive have `error` and `ok` fields.

Usage Examples

Correct

# eslint @graphql-eslint/require-type-pattern-with-oneof: 'error'
 
type Mutation {
  doSomething: DoSomethingMutationResult!
}
 
interface Error {
  message: String!
}
 
type DoSomethingMutationResult @oneOf {
  ok: DoSomethingSuccess
  error: Error
}
 
type DoSomethingSuccess {
  # ...
}

Resources

Last updated on