I have a use case to allow only a certain set of enum values into input for a mutation / display. I'm not quite sure how to best handle this.
Given the following:
import gql from 'graphql-tag';
export default gql`
enum DayOfWeek {
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
SUNDAY
}
`;
I'd like to limit the selection values at certain locations of the schema.
I was hoping that I could do something like:
import gql from 'graphql-tag';
export default gql`
union Weekday = MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY
union Weekend = SATURDAY | SUNDAY
The schema never seems to validate. I've also tried referencing these as DayOfWeek.MONDAY
, etc, to no avail.
Is there a way to mimic this functionality?