Skip to content
\n

I want to ensure that you can't submit a NewLocation unless you provide either a NewAddress or a NewCoordinate. I thought that an Enum would be great for that but I'm not seeing a way to implement an Enum as an input object in The Book. I do however see an Enum here: https://docs.rs/juniper/latest/juniper/enum.InputValue.html

\n

Some guidance would be much appreciated

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

GraphQL enums are like C-style enums without inner type, so what you are looking for are GraphQL unions. Unfortunately as of now GraphQL doesn't support unions as input types. So for now you have to validate your input objects manually.

","upvoteCount":1,"url":"https://github.com/graphql-rust/juniper/discussions/1112#discussioncomment-3876548"}}}
Discussion options

You must be logged in to vote

GraphQL enums are like C-style enums without inner type, so what you are looking for are GraphQL unions. Unfortunately as of now GraphQL doesn't support unions as input types. So for now you have to validate your input objects manually.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ilslv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants