-
Notifications
You must be signed in to change notification settings - Fork 57
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
Graphql 17 support #185
Graphql 17 support #185
Conversation
Thanks for your contribution @igrlk. We added already test runs for the alpha version of 17. It seems that the tests that run also with GraphQL 15 and GraphQL 16 need fixing. Do you want to look into it to add support for older versions? We have version-specific code in style graphql-jit/src/__tests__/json.test.ts Lines 133 to 139 in 3cbb8b1
|
@oporkka thanks for checking this PR! Yep I'm happy to fix the tests for other versions - would you mind allowing me to run the github checks? It will make the process faster :) |
…Type syntax since old versions were deprecated and removed from graphql@17
41f459c
to
f27a194
Compare
468f612
to
aae9d94
Compare
Hey @oporkka I was able to get the tests green on node 14, 16, 18 in combo with graphql 15, 16, 17 locally. Pushed all the changes to the branch |
Tests allowed, but fail on coverage. I am not sure why they start failing after the change, is it actually the support for version info that causes the branch coverage to degrade? In any case, propose to lower the target for now to 91% to make all the tests run |
Decreased the coverage threshold for branches to 91. Still can't run the tests btw, looks like I need to become a contributor in the repo first to be able to run them |
@oporkka thanks for running the tests. Since I've added the additional |
src/format-error.ts
Outdated
import * as utilities from "graphql/error"; | ||
import { GraphQLFormattedError } from "graphql/error"; | ||
|
||
export const formatError = (error: GraphQLError): GraphQLFormattedError => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please refactor to function declaration instead of using arrow function expression.
src/get-graphql-error-options.ts
Outdated
import { ASTNode } from "graphql/language/ast"; | ||
import { GraphQLError, versionInfo } from "graphql"; | ||
|
||
export const getGraphQLErrorOptions = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to the src/compat.ts
file
src/compat.ts
Outdated
export const getOperationRootType = ( | ||
schema: GraphQLSchema, | ||
operation: OperationDefinitionNode | ||
): GraphQLObjectType => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please refactor this arrow function expression to function declaration.
package.json
Outdated
"functions": 96, | ||
"lines": 96, | ||
"statements": 96 | ||
} | ||
} | ||
}, | ||
"peerDependencies": { | ||
"graphql": ">=15" | ||
"graphql": ">=17" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This we should keep as >=15
for now, as we still support 15
package.json
Outdated
@@ -72,7 +72,7 @@ | |||
"eslint-plugin-node": "^11.1.0", | |||
"eslint-plugin-promise": "^5.1.1", | |||
"eslint-plugin-standard": "^5.0.0", | |||
"graphql": "^16.0.0", | |||
"graphql": "^17.0.0-alpha.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be also changed back to 16 before merging, as 17 is nevertheless still alpha. We will keep support in test runs, though.
Fixed the tests |
.idea/modules.xml
Outdated
@@ -0,0 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this file. I propose to have .idea/
in your global .gitignore file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing the file from the PR and for the global .gitignore suggestion :)
👍 |
👍 |
@igrlk Sorry for the delay, we just forgot to follow up on this as other things popped up. |
👋 Hi. I didn't get a response for this question about graphql@17 support and decided to go ahead and make
graphql-jit
work with the latestgraphql-js
This PR stops using things that were deprecated in
graphql@17
and doesn't add any new functionality like@defer
support - thankfullygraphql spec
says that it's not required to support @stream/@defer directives to be fully spec compatible.I think we don't need to merge it into main branch until
graphql@17
is releasedHappy to hear any feedback from the contributors on this. Cheers! 🎩