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

use GraphQLAppliedDirective instead of GraphQLDirective for printing FederationSDL #223

Closed
wants to merge 1 commit into from

Conversation

nagliyvred
Copy link

Latest graphql-java is reimplementing directives graphql-java/graphql-java#2562 and moving to GraphQLAppliedDirective instead.
Similarly, graphql-java-kickstart project is being updated to make use of GraphQLAppliedDirective too graphql-java-kickstart/graphql-java-tools#663 .
This breaks federation, as the schema built with the latest graphql-java-tools would not contain any GraphQLDirective and therefore generated SDL is going to have all of the federation-related directives missing.
This PR is meant to address it by getting FedarationSdlPrinter to use the new directive classes everywhere, except where the actual directive definition is printed.

@apollo-cla
Copy link

@nagliyvred: 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/

@dariuszkuc
Copy link
Member

👋 thanks for raising this, indeed it looks like I missed it when I fixed the entity lookup logic in #214.

That SDL printer is a copy from graphql-java v17.3, since we are using graphql-java v18 now it would be great to update it to the latest.

Two considerations

  • for federation v2 we won't need custom printer once graphql-java v19 is released (there is a bug in v18 that does not print schema directives)
  • for federation v1 we need custom logic to skip federation directive definitions

Would you be willing to update the printer to the latest https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/idl/SchemaPrinter.java?

dariuszkuc added a commit to dariuszkuc/federation-jvm that referenced this pull request Jul 27, 2022
`FederationSdlPrinter` is a copy of a `graphql.schema.idl.SchemaPrinter` from `graphql-java` v17 with some custom filtering logic that was required for Federation v1.

`graphql-java` v18 introduced concept of applied directive to make a distinction from the directive definition (previously same `GraphQLDirective` type was used for both). This PR drops our custom copy of the schema printer and instead updates our logic to rely on the built-in schema printer provided by the `graphql-java`. Using custom predicates for filtering directives and schema elements we can replicate our custom functionality without the need of a custom printer.

Related:

* resolves: apollographql#227
* resolves: apollographql#216
* supersedes: apollographql#223
@dariuszkuc
Copy link
Member

Superseded by #231

@dariuszkuc dariuszkuc closed this Jul 27, 2022
dariuszkuc added a commit that referenced this pull request Jul 28, 2022
`FederationSdlPrinter` is a copy of a `graphql.schema.idl.SchemaPrinter` from `graphql-java` v17 with some custom filtering logic that was required for Federation v1.

`graphql-java` v18 introduced concept of applied directive to make a distinction from the directive definition (previously same `GraphQLDirective` type was used for both). This PR drops our custom copy of the schema printer and instead updates our logic to rely on the built-in schema printer provided by the `graphql-java`. Using custom predicates for filtering directives and schema elements we can replicate our custom functionality without the need of a custom printer.

Related:

* resolves: #227
* resolves: #216
* supersedes: #223
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.

None yet

3 participants