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

Enum members should be quoted if numeric #4834

Closed
e10jon opened this issue Sep 30, 2020 · 7 comments
Closed

Enum members should be quoted if numeric #4834

e10jon opened this issue Sep 30, 2020 · 7 comments
Labels
plugins waiting-for-release Fixed/resolved, and waiting for the next stable release

Comments

@e10jon
Copy link

e10jon commented Sep 30, 2020

See the screenshot below. The problem is easily solved by quoting the problematic members.

image

@ntziolis
Copy link

ntziolis commented Oct 9, 2020

We ran into the same issue. We were able to use the workaround enumAsTypes: true, but this is not optimal since the angular language service does not provide syntax checking for literal union types in the template part of components. While it does support syntax checking for enums.

If a sample is needed we can provide one.

@borremosch
Copy link
Contributor

borremosch commented Oct 9, 2020

Could either of you provide your GraphQL schema + plugin options or a Code Sandbox to reproduce the issue?

@aderaaij
Copy link

Got the same thing, in this case it's the standard WordPress thumbnail sizes which are named 1536x1536 and 2048x2048. @borremosch I can spin up an example site but it's basically the schema provided by https://www.wpgraphql.com/

@borremosch
Copy link
Contributor

Great, thanks! I will have a look soon to see if I can reproduce the problem

@aderaaij
Copy link

@borremosch if you want, you can use https://wp-headless.arden.nl/wp/graphql as an endpoint, should give you the same result. thanks!

@borremosch
Copy link
Contributor

I have submitted a pull request. The leading underscore is removed from the enum identifier when it is PascalCased. This seems to be a design decision in graphql-codegen, so I chose to not bother with removing the leading underscore, and to quote the identifier instead as was suggested. This seems to be more in line with the current enum naming philosophy, and does not introduce any breaking changes.

@dotansimha dotansimha added bug plugins waiting-for-release Fixed/resolved, and waiting for the next stable release labels Oct 19, 2020
@dotansimha
Copy link
Owner

Fixed in @graphql-codegen/typescript@1.17.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins waiting-for-release Fixed/resolved, and waiting for the next stable release
Projects
None yet
Development

No branches or pull requests

5 participants