Skip to content

Commit

Permalink
Disallow composing @authenticated via @composeDirective
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-scheer committed Jul 12, 2023
1 parent 0662fdb commit 70b695d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions composition-js/src/__tests__/compose.composeDirective.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('composing custom core directives', () => {
});

it.each([
'@tag', '@inaccessible',
'@tag', '@inaccessible', '@authenticated',
])('federation directives that result in a hint', (directive) => {
const subgraphA = generateSubgraph({
name: 'subgraphA',
Expand All @@ -282,13 +282,13 @@ describe('composing custom core directives', () => {
});

it.each([
'@tag', '@inaccessible',
'@tag', '@inaccessible', '@authenticated',
])('federation directives (with rename) that result in a hint', (directive) => {
const subgraphA = {
name: 'subgraphA',
typeDefs: gql`
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.1", import: [{ name: "@key" }, { name: "@composeDirective" } , { name: "${directive}", as: "@apolloDirective" }])
@link(url: "https://specs.apollo.dev/federation/v2.5", import: [{ name: "@key" }, { name: "@composeDirective" } , { name: "${directive}", as: "@apolloDirective" }])
@link(url: "https://specs.apollo.dev/link/v1.0")
@composeDirective(name: "@apolloDirective")
Expand Down
1 change: 1 addition & 0 deletions composition-js/src/composeDirectiveManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class ComposeDirectiveManager {
const directivesComposedByDefault = [
sg.metadata().tagDirective(),
sg.metadata().inaccessibleDirective(),
sg.metadata().authenticatedDirective(),
].map(d => d.name);
if (directivesComposedByDefault.includes(directive.name)) {
this.pushHint(new CompositionHint(
Expand Down

0 comments on commit 70b695d

Please sign in to comment.