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

Support schema directives #717

Open
3 tasks done
dariuszkuc opened this issue Nov 3, 2022 · 2 comments
Open
3 tasks done

Support schema directives #717

dariuszkuc opened this issue Nov 3, 2022 · 2 comments

Comments

@dariuszkuc
Copy link

I want to suggest an idea and checked that ...

  • ... to my best knowledge, my idea wouldn't break something for other users
  • ... the documentation does not mention anything about my idea
  • ... there are no open or closed issues that are related to my idea

Description

SchemaParser currently does not process schema definitions which can include directive information.

Use Cases

Apollo Federation v2 relies on a schema @link directive to link definitions from external specification to the local schema. Gateway requires this link information to determine whether Federation v2 features can be used or it has to fallback to the v1 logic.

extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])

See https://github.com/apollographql/apollo-federation-subgraph-compatibility/ for example federation integration.

@oryan-block
Copy link
Collaborator

@dariuszkuc can you check if #763 resolved this?

@sanvikalx
Copy link

sanvikalx commented Jul 30, 2024

@oryan-block
The issue is still reproducing in latest 13.1.1 version
E.g.
https://github.com/sanvikalx/schema-directives-support/blob/master/src/test/java/org/example/SchemaDirectivesSupportTest.java

    @Test
    void testIt() {
        GraphQLSchema graphQLSchema = SchemaParser.newParser().schemaString("""
                        extend schema @link(url: "https://specs.apollo.dev/federation/v2.3",
                            import: ["@key", "@shareable", "@inaccessible"])
                                                
                        type Query {
                            fdrDiscovery: FdrDiscoveryResponse @shareable
                                                
                        }
                                                
                        type FdrDiscoveryResponse @key(fields: "dummyId") {
                                                
                            dummyId: String @inaccessible
                            hello: String
                        }
                        """)
                .resolvers(new QueryResolverImpl())
                .build()
                .makeExecutableSchema();

        Assertions.assertNotNull(graphQLSchema);
    }

It was working in 13.0.1 but now it's broken.
So test will run success if switch to 13.0.1
https://github.com/sanvikalx/schema-directives-support/blob/master/pom.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants