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

addResolversToSchema should not lose directives #1623

Merged
merged 4 commits into from Jun 10, 2020
Merged

Conversation

yaacovCR
Copy link
Collaborator

@yaacovCR yaacovCR commented Jun 9, 2020

first attempt at fix for #1587

requires some thinking as to whether this is a breaking change.

requires some new tests?

@theguild-bot
Copy link
Collaborator

theguild-bot commented Jun 9, 2020

The latest changes of this PR are available as alpha in npm: 6.0.10-alpha-5b93e0e.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.0.10-alpha-5b93e0e.0

@yaacovCR yaacovCR changed the title addResolversToSchema should not loses directives addResolversToSchema should not lose directives Jun 10, 2020
@yaacovCR yaacovCR force-pushed the fix-merge-scalar branch 2 times, most recently from 2595719 to 799b280 Compare June 10, 2020 01:29
@yaacovCR
Copy link
Collaborator Author

after a few false starts, I added one test.

@ardatan and all,

This PR merges in the astNode, extensionASTNodes and also extensions.

It does a deep merge for extensions. Is that right? Should it replace by key instead?

@yaacovCR
Copy link
Collaborator Author

switched it to a shallow merge, i think that is more well-defined.

Not likely to be an issue...probably a pretty rare workflow which is using addResolversToSchema for scalars/enums with extensions defined on both the original schema and the new types in the resolvers map.

@yaacovCR
Copy link
Collaborator Author

We do have to wonder if this is a breaking change, as now addResolversToSchema doesn't overwrite the astNode, extensionASTNodes, and extension fields, and maybe there were some out there relying on that. Seems unlikely, but just a point to consider.

Thoughts?

@ardatan
Copy link
Owner

ardatan commented Jun 10, 2020

Shallow merging sounds good to me. If we get bug reports, we can think it again later.

@yaacovCR yaacovCR merged commit 5b93e0e into master Jun 10, 2020
@yaacovCR yaacovCR deleted the fix-merge-scalar branch June 10, 2020 10:20
@ardatan ardatan added the bugfix label Jun 11, 2020
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.

None yet

3 participants