🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
Require 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