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

Fixes #1617: Federation Enum not parsing value 0 #1618

Merged
merged 3 commits into from
Dec 5, 2019

Conversation

ShadyKutz
Copy link
Contributor

@ShadyKutz ShadyKutz commented Oct 25, 2019

Fixes #1617

Updated buildSchemaFromSDL to handle enums with a value of 0. Previously, when an enum had a value of 0, the name would be used as the enum value.

Added a unit test to ensure 0 is parsed correctly.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@apollo-cla
Copy link

@postman-nz: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@ShadyKutz
Copy link
Contributor Author

I'm working on the CLA, just need to confirm with my employer that it's ok to sign.

@ShadyKutz ShadyKutz changed the title Fixes #1617 Fixes #1617: Federation Enum not parsing value 0, works other values Oct 30, 2019
@ShadyKutz ShadyKutz changed the title Fixes #1617: Federation Enum not parsing value 0, works other values Fixes #1617: Federation Enum not parsing value 0, works with other values Oct 30, 2019
@marjorg
Copy link

marjorg commented Nov 13, 2019

@postman-nz We ran into the same issue with our Federations, did you get around to signing the CLA so the PR can proceed?

@ShadyKutz
Copy link
Contributor Author

@marjorg Yes I have signed the CLA, and completed all the requirements for the PR to pass.

As a workaround, we hard coded all our 0 enum values to -1 (assuming -1 isn't being used), and in our resolvers added a check:
if(model.enumValue == 0) model.enumValue = -1

Which works for now, but it's not a long term solution.

Copy link
Contributor

@lilyball lilyball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no context here but the fix looks straightforward.

packages/apollo-graphql/src/schema/buildSchemaFromSDL.ts Outdated Show resolved Hide resolved
@ShadyKutz
Copy link
Contributor Author

Hi @JakeDawkins and @jbaxleyiii,

Is there anything else I have to do to get this PR completed? (I'm new to contributing to public repos, so not 100% sure on the process)

Thanks!

@JakeDawkins
Copy link
Contributor

Hey @postman-nz! So sorry for letting this slip through the cracks. Everything looks good to me! Can you rebase this branch off master? My Update Branch button isn't working for some reason 🤔

@JakeDawkins JakeDawkins self-assigned this Dec 4, 2019
Stephen Post added 3 commits December 5, 2019 07:51
Updated buildSchemaFromSDL to handle Enums with a value of 0. Previously, when an enum had a value of 0, the name would be used as the enum value.

Added a unit test to ensure 0
@ShadyKutz
Copy link
Contributor Author

Hey @postman-nz! So sorry for letting this slip through the cracks. Everything looks good to me! Can you rebase this branch off master? My Update Branch button isn't working for some reason 🤔

No problem mate! I have rebased with master (I hope 😄). Let me know if there is anything else you'd like me to do.

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

Successfully merging this pull request may close these issues.

Federation Enum not parsing value 0, works other values
5 participants