Closed arkllc closed 4 years ago
@arkllc Could you be specific on what you are referring to? Where is the enum defined?
Hello @arkllc Our getting started documentation goes over how the Amplify CLI generates code for your GraphQL schema. Docs: https://docs.amplify.aws/start/q/integration/react
Should you have any other questions please comment below.
Sorry for the delayed response.
Suppose I have the following Schema. How can I get the values of the enum defined in the schema from my front end application? I feel that I am missing something obvious.
type Pricing @model (subscriptions: null)
@key (fields: [ "tier", "combo" ] )
@auth(rules: [{allow: groups, groups: ["SysAdmin", "Sysops","SysSupport","SysBackend"], operations: [create,read,update,delete]},
{allow: private, operations: [read]}
]){
tier: TierType!
combo: String!
cost: Float
}
enum TierType {
STANDARD
PREMIUM
PROMOTION_A
LIST_PRICE
}
@arkllc Currently code-gen does not expose the enums. Please follow the enhancement issue here: https://github.com/aws-amplify/amplify-cli/issues/2412
@arkllc
query ListEnumValues($enum: String!) {
enum: __type(name: $enum) {
enumValues {
name
}
}
}
//Variable:
{ "enum": "TierType" }
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Which Category is your question related to? amplify cli
Amplify CLI Version Not alpplicable
What AWS Services are you utilizing? Amplify cli, appsync
Provide additional details e.g. code snippets How should the front end try to get all the allowed values that are declared in an enum as part of the schema? Are there any best practices around this.
I am pretty new to GraphQL and AppSync, so please excuse me if this is a dumb question.