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

Update documentation to clarify that enum keys are what are passed in/out of resolvers. #1714

Open
dwjohnston opened this issue Jun 24, 2024 · 0 comments
Labels
Community 👨‍👧 Something initiated by a community Documentation 📖 Issues about docs

Comments

@dwjohnston
Copy link

dwjohnston commented Jun 24, 2024

Describe the issue

An issue I have just experience is when I have an enum like:

enum Status = {
    PENDING = "P", 
    COMPLETE = "C"
}

registerEnumType(Status, {name: "Status}); 

Where I'm hoping to use a query argument like : {status: 'P'}.

That this won't work, GraphQL will resolve the on the keys of the enum, not the values.

There are github issues that similarly reference this issue:

#741
#1521

and this section of the documentation is linked:

https://typegraphql.com/docs/enums.html#interoperability

However, what this doesn't communicate is that the use of enums expects the enum keys to be passed into resolvers/returned from resolvers. This pitfall should be more strongly emphasised.

Are you able to make a PR that fix this?

Sure.

Additional context
Add any other context about the problem here.

@dwjohnston dwjohnston changed the title Update documentation to clarify that Enum values must match the keys. Update documentation to clarify that enum keys are what are passed in/out of resolvers. Jun 24, 2024
@MichalLytek MichalLytek added Community 👨‍👧 Something initiated by a community Documentation 📖 Issues about docs labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community 👨‍👧 Something initiated by a community Documentation 📖 Issues about docs
Projects
None yet
Development

No branches or pull requests

2 participants