Amplify-cli: Using enums in our graphql schema

Created on 25 Sep 2019  路  2Comments  路  Source: aws-amplify/amplify-cli

We are using enums in our graphql schema in Amplify/AppSync.

We are confused as to what Amplify enforces and how to use the enums. Simply saving the string values works fine but we'd really like to limit available options to enums to add integrity to the code.

What is the best way to save an enum using a mutator and to compare queried values using the enum. The generated /src/graphql files don't seem to expose the enum values.

code-gen enhancement pending-review

Most helpful comment

Is there an update on this? Haven't got round to using my enums on the client side but I just checked my generated TypeScript definitions and they seem to be there:

export enum Platform {
  IOS = "IOS",
  ANDROID = "ANDROID",
}

Has this been implemented and the issue just not closed, or is there still an issue with using enums that I haven't yet encountered?

All 2 comments

Codegen does not expose the enums. I am adding this to our back log and we will work on this once the product team prioritize this.

Is there an update on this? Haven't got round to using my enums on the client side but I just checked my generated TypeScript definitions and they seem to be there:

export enum Platform {
  IOS = "IOS",
  ANDROID = "ANDROID",
}

Has this been implemented and the issue just not closed, or is there still an issue with using enums that I haven't yet encountered?

Was this page helpful?
0 / 5 - 0 ratings