François Romain
François Romain

Reputation: 14393

name was defined in resolvers, but enum is not in schema

with appolo server 2 beta,

I have a resolver like:

Travaux: new GraphQLEnumType({
  name: 'Travaux',
  values: {
    ins: { value: 'en instruction' },
    val: { value: 'valide' },
    ech: { value: 'échu' }
  }
})

and a Schema

gql`
  type Query {
    titre(id: String!): Titre
  }

  type Titre {
    travaux: Travaux
  }

  enum Travaux {
    ins
    val
    ech
  }
`

This makes an error:

Travaux.name was defined in resolvers, but enum is not in schema

If I remove the Travaux resolver, it works… What is arong here?

Upvotes: 1

Views: 859

Answers (1)

François Romain
François Romain

Reputation: 14393

The resolver has to be:

Travaux = {
  ins: 'en instruction',
  val: 'valide',
  ech: 'échu'
}

Upvotes: 1

Related Questions