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

can this support generating enum with given values? #65

Open
tx0c opened this issue Nov 6, 2021 · 2 comments
Open

can this support generating enum with given values? #65

tx0c opened this issue Nov 6, 2021 · 2 comments

Comments

@tx0c
Copy link

tx0c commented Nov 6, 2021

GraphQL allows enum with allow values in resolvers
https://www.apollographql.com/docs/apollo-server/schema/schema/#internal-values-advanced

but this is generating always the enum's literal string value, is there anyway can support given values?

https://blog.logrocket.com/what-you-need-to-know-about-graphql-enums/

to make GraphQL

enum AuthType {
 GOOGLE =  'google-auth',
 GITHUB =  'github-auth',
 OUTLOOK = 'outlook-auth',
}

to generate TypeScript

export const enum AuthType {
 GOOGLE =  'google-auth',
 GITHUB =  'github-auth',
 OUTLOOK = 'outlook-auth',
}
@tony
Copy link
Contributor

tony commented Feb 10, 2022

@tx0c Did you ever find another project or script of your own that could do this? It'd be very valuable to be able to generate a .ts file with concrete enums.

@tony
Copy link
Contributor

tony commented Feb 10, 2022

Across the pond in apollo: apollographql/apollo-tooling#1750, apollographql/apollo-tooling#1044

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants