From 006d9ee4985fd3bbeb95e8e9e2f57da373ae6221 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Thu, 10 Sep 2026 15:00:46 +0200 Subject: [PATCH 1/2] fix ContectFieldValue being marked as inaccessible --- ...add-inaccessible-to-unreachable-types.spec.ts | 16 +++++++++++++--- .../add-inaccessible-to-unreachable-types.ts | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/__tests__/contracts/add-inaccessible-to-unreachable-types.spec.ts b/__tests__/contracts/add-inaccessible-to-unreachable-types.spec.ts index 31bd12f..86d635c 100644 --- a/__tests__/contracts/add-inaccessible-to-unreachable-types.spec.ts +++ b/__tests__/contracts/add-inaccessible-to-unreachable-types.spec.ts @@ -113,17 +113,21 @@ test("Filters based on tags", async () => { `); }); -test("Inaccessible is not added on built-in Federation types ContextArgument and FieldValue", async () => { +test("Inaccessible is not added on built-in Federation and context types", async () => { const sdl = /* GraphQL */ ` extend schema - @link(url: "https://specs.apollo.dev/federation/v2.9", import: ["@key"]) + @link( + url: "https://specs.apollo.dev/federation/v2.9" + import: ["@context", "@fromContext", "@key"] + ) type Query { me: Me } - type Me @key(fields: "id") { + type Me @key(fields: "id") @context(name: "me") { id: ID! + contextualField(value: ID @fromContext(field: "$me { id }")): String } `; @@ -158,4 +162,10 @@ test("Inaccessible is not added on built-in Federation types ContextArgument and expect(compositionResult.supergraphSdl).to.include( "input join__ContextArgument {\n", ); + expect(compositionResult.supergraphSdl).to.include( + "scalar context__ContextFieldValue\n", + ); + expect(compositionResult.supergraphSdl).to.not.include( + "scalar context__ContextFieldValue @inaccessible", + ); }); diff --git a/src/contracts/add-inaccessible-to-unreachable-types.ts b/src/contracts/add-inaccessible-to-unreachable-types.ts index 6884a2f..545c892 100644 --- a/src/contracts/add-inaccessible-to-unreachable-types.ts +++ b/src/contracts/add-inaccessible-to-unreachable-types.ts @@ -1,4 +1,3 @@ -import { DocumentNode } from "graphql"; import { CompositionSuccess, createCompositionSuccessReadCacheContainer, @@ -37,6 +36,7 @@ export const addInaccessibleToUnreachableTypes = ( resolveName("https://specs.apollo.dev/join", "DirectiveArguments"), resolveName("https://specs.apollo.dev/join", "ContextArgument"), resolveName("https://specs.apollo.dev/join", "FieldValue"), + resolveName("https://specs.apollo.dev/context", "ContextFieldValue"), ]); // we retrieve the list of reachable types from the public api sdl From f0e0ca534c214c4d117907ebb114e31735c42b7c Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Thu, 10 Sep 2026 15:04:01 +0200 Subject: [PATCH 2/2] changeset --- .changeset/lucky-bikes-jam.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lucky-bikes-jam.md diff --git a/.changeset/lucky-bikes-jam.md b/.changeset/lucky-bikes-jam.md new file mode 100644 index 0000000..bfada9f --- /dev/null +++ b/.changeset/lucky-bikes-jam.md @@ -0,0 +1,5 @@ +--- +"@theguild/federation-composition": patch +--- + +Fix scalar `ContextFieldValue` being annotated with `@inaccessible` within the supergraph when composing a contract schema.