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

Importing and renaming @key directive #379

Open
RoKKim opened this issue Feb 9, 2024 · 1 comment
Open

Importing and renaming @key directive #379

RoKKim opened this issue Feb 9, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@RoKKim
Copy link

RoKKim commented Feb 9, 2024

Let's say I import the @key directive as @myKey:

extend schema @link(url: "https://specs.apollo.dev/federation/v2.5", import: [{name : "@key", as : "@myKey"}, "@requiresScopes", "Scope", "FieldSet"])

type Product @myKey(fields: "id") {
    id: ID!
    name: String!
    supplier: String @requiresScopes(scopes: [["scopeA"]])
}

In this scenario, the following code inside the com.apollographql.federation.graphqljava.SchemaTransformer#entityPredicate method will fail:
entityCandidate.getAllDirectivesByName().containsKey(FederationDirectives.keyName)

This occurs because FederationDirectives.keyName is hardcoded to "key". As a result, the _Entity will not be generated in the schema by the com.apollographql.federation.graphqljava.SchemaTransformer#build.

@dariuszkuc dariuszkuc added the type: bug Something isn't working label Feb 10, 2024
@panatl
Copy link

panatl commented Feb 19, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants