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

Upgrade to graphql 16 #686

Merged
merged 1 commit into from Dec 20, 2021
Merged

Upgrade to graphql 16 #686

merged 1 commit into from Dec 20, 2021

Conversation

gdorsi
Copy link
Contributor

@gdorsi gdorsi commented Dec 16, 2021

fixes #628

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Good work!

LGTM

extensions: {
value: err.extensions || undefined
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got this error error.toJSON is not a function

That's because they changed the formatError impl to simply do return error.toJSON();

I thought it was safer to move to new GraphQLError

Should I go back to Object.create?

Doing Object.create(GraphQLError.prototype, would also solve the issue

@@ -1,126 +0,0 @@
'use strict'
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason on why this file has been deleted? I mean, just to make sure it wasn't by mistake 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's dependencies are not yet compatible with graphql 16

Discussion here --> #628 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

rather than delete, isn't this something we can upgrade to work with graphql@16? In any case we should think about a better way other than deleting. Even if they are not compatible, I assume they will be at some point, meaning that we may want to keep the example around in some way

@simoneb
Copy link
Collaborator

simoneb commented Dec 20, 2021

what's the plan with this PR? I assume that once we make mercurius compatible with graphql@16 we break compatibility with 15. Do we release a new semver major version where we introduce this breaking change? /cc @mcollina

@@ -129,6 +129,7 @@ function getStubTypes (schemaDefinitions, isGateway) {

function gatherDirectives (type) {
let directives = []
/* istanbul ignore else seems that extensionASTNodes is always provided in graphql16+, we are keeping this check for safety */
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this comment doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In graphql 15 extensionASTNodes could be either null or Array

Now it is only Array but I thought that was safer to keep the check.

I've added this comment to get the 100% coverage and explain why I didn't get rid of it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok so this comment mixes an istanbul command with human-readable information.
I would recommend we keep the two separated, meaning, 2 comments

@mcollina mcollina added this to the v9.0.0 milestone Dec 20, 2021
@mcollina mcollina merged commit bef9669 into mercurius-js:master Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't work with graphql v16+
4 participants