-
Notifications
You must be signed in to change notification settings - Fork 68
Fixes for graphql-java:14 compatibility #46
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
Conversation
|
@paulbakker: 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/ |
glasser
left a comment
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 looking into this!
| .includeScalarTypes(true) | ||
| .includeExtendedScalarTypes(true) | ||
| .includeSchemaDefintion(true) | ||
| .includeSchemaDefinition(true) |
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.
Do these changes mean that this version would not work with GraphQL-Java 13 at all? (Probably OK to require upgrades but worth thinking about.)
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.
Yes, that's correct unfortunately.
| assertNotNull(_service); | ||
| final String sdl = (String) _service.get("sdl"); | ||
| assertEquals(expected.trim(), sdl.trim()); | ||
| assertEquals(expected.replaceAll("\n\n", "").trim(), sdl.replace(directivesExclude, "").replaceAll("\n\n", "").trim()); |
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.
Why not use removeDirectives?
| assertEquals(expected.replaceAll("\n\n", "").trim(), sdl.replace(directivesExclude, "").replaceAll("\n\n", "").trim()); | ||
| } | ||
|
|
||
| static String removeDirectives(String sdl) { |
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 should probably be called something like removeSpecDirectives or removeBuiltInDirectives or something (and the fixture file changed too).
| "type _Service {\n" + | ||
| " sdl: String!\n" + | ||
| "}\n", SchemaUtils.printSchema(federated)); | ||
| "}", SchemaUtils.removeDirectives(SchemaUtils.printSchema(federated)).trim()); |
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.
Do you understand what change in GraphQL-Java is necessitating this? Is this definitely just a testing issue? Note that part of federation is making the _Service.sdl field which uses the GraphQL-Java schema printer to print some SDL and return it to users (see SchemaTransformer.sdl()), so if this upgrade affects the output of that field, that might be an issue.
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.
I don't. I just started looking at upgrading to 14, and it's a big breaking release. The incompatibility with the federation lib is currently blocking to do any testing with federated services, so it's also hard to say what else might be broken. If we can do some sort of snapshot release that would give a much better idea what else needs to happen.
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.
The change appears to be on purpose.
The code change is here: PR.
graphql-java # 1587 describes the rationale.
Standard directives are not printed when the includeDirectives flag is set. This seems like a design choice ...
However this causes issues when we have to input the SDL to other GraphQL services that are not running graphql-java that don't default to having those declared. Can we add these to the SDL?
This should be a safe change. Note that the directives that are seen in the output are standard GraphQL directives that are part of the spec (include, skip and deprecated).
de025e0 to
cbcfd05
Compare
|
Update: I've published this internally (Netflix) and did some rollouts. Looking good so far. It's a bit of a weak guarantee, but at least it didn't completely go up in flames. |
|
See also #41 (these PRs should be looked at in parallel) |
The changes in this MR look to be a more appropriate way forward. I left some comments on #41, I'll summarize here. #41 allows consumers of the |
|
@glasser is this something that can be merged? I believe I've added sufficient information to alleviate any concerns here. |
|
@mcohen75 |
|
Following this issue as we would love to migrate to use this library in graphql-kotlin over our own implementation here: However we have upgraded to graphql-java 14 so we are also blocked |
|
@sachindshinde March 9th is a long ways off. Is there any way this could be handled sooner? It looks like this MR is in good shape and can be merged. |
|
@paulbakker @smyrick @mcohen75 I did some investigating with the Apollo Gateway team, and it turns out that including directive definitions for standard directives ( There's a quick fix by using I've went ahead and made a PR for that at #51 . |
|
Compatibility for |
Some minor required fixes to be compatible with graphql-java:14.
includeSchemaDefinitionoption of the SchemaPrinterFor a generated sdl it would now include the directives plus descriptions, I modified the TestUtils to account for this.