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
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"}}}-
|
I have the following setup: I want to ensure that you can't submit a Some guidance would be much appreciated |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
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.