* Which Category is your question related to? *
API
* What AWS Services are you utilizing? *
Appsync via Amplify
* Provide additional details e.g. code snippets *
I want to access possible enum values in order to programmatically generate React components, e.g. a dropdown input with option tags. What is the advised way of accessing and/or exposing enums via Appsync? Access to the enums is not included in the generated code.
Hey @kwhitejr,
There are two ways to do this:
I believe your use case calls for option 2.
On advice from @jordanranz and some more research into graphql introspection, I was able to get at my enums with this query:
export const listEnumValues = `query ListEnumValues($enum: String!) {
enum: __type(name: $enum) {
enumValues {
name
}
}
}`;
Most helpful comment
On advice from @jordanranz and some more research into graphql introspection, I was able to get at my enums with this query: