Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing Enums Directly from GraphQL Client #3104

Open
2 tasks
MattWlodarski opened this issue Jan 6, 2025 · 1 comment
Open
2 tasks

Referencing Enums Directly from GraphQL Client #3104

MattWlodarski opened this issue Jan 6, 2025 · 1 comment
Labels
feature-request New feature or request Gen 2

Comments

@MattWlodarski
Copy link

Describe the feature you'd like to request

We need a way to directly reference an enum we created in our schema in our frontend app code. Currently, I have been running: npx ampx generate graphql-client-code and putting the resulting API.ts file in a shared folder and then importing the desired enum from there, but it would be nice to be able to import the enum directly from graphQLClient like we do with mutations and queries.

Describe the solution you'd like

Currently, you can import the schema like so: import type { Schema } from '../amplify/data/resource';

so the simplest solution would be something like this: import enum { someEnumName } from '../amplify/data/resource';

Describe alternatives you've considered

I have been running: npx ampx generate graphql-client-code and putting the resulting API.ts file in a shared folder and then importing the desired enum from there, but this is a bit clunky since you have to regenerate this file whenever you make a change to your schema.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@AnilMaktala
Copy link
Member

Hello @MattWlodarski, Thanks for raising this. We have marked this as a feature request for the team to evaluate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request Gen 2
Projects
None yet
Development

No branches or pull requests

2 participants