2

What is the graphql syntax in SDL to use an enum as a query argument?

schema {
  query: Query
}
type Query {
    getWordsCountByLanguage (language: LanguageIso): [WordCount]
}
enum LanguageIso {
    AA
    AB
}

Parsing the above schema will throw an error that Expected type 'language' to be a GraphQLInputType, but it wasn't!

Defining an input type that includes an enum will result on a similar error.

It looks like there is no way of using an enum as a query argument in SDL.

1 Answer 1

1

There is a bug already reported here The issue is with nested inputs (i.e., you have an input argument that contains an enum). If you directly pass the enum as argument as in my question should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.