Skip to content

New feature Request: To allow null, string in Enum #384

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

Merged
merged 3 commits into from
Sep 28, 2021

Conversation

benny1hk
Copy link
Contributor

Allow using null and empty String and number as the first char in Enum keys, which make easier for legacy mongoose project to migrate.

@nodkz nodkz merged commit a7a5485 into graphql-compose:master Sep 28, 2021
@nodkz
Copy link
Member

nodkz commented Sep 28, 2021

Thanks for contribution

But be aware of a NULL value. According to GraphQL implementation, it can not return null values as NULL in output types. But for input it will work correctly - you pass NULL as a string in arguments it transformed to null in resolver args.

// inside resolvers should be provided real values for null & string
expect(lastResolverInputArg).toEqual(['val1', null, '']);
// in output JSON should be provided keys
// BUT be aware `null` does not converted back to `NULL` string
expect(result).toEqual({ data: { test: ['val1', null, 'EMPTY_STRING'] } });

@github-actions
Copy link

🎉 This PR is included in version 9.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants