From 6d7ccf2e98ead837847ab1b16b44b3b68adbfe84 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Thu, 21 Nov 2024 17:04:42 +0100 Subject: [PATCH] feat: add support for @composeDirective (#3) Co-authored-by: Yannick Utard --- .github/workflows/semantic-pr-title.yml | 48 +++++++ .github/workflows/semantic.yml | 116 ---------------- ...derated_document_from_schema_definition.rb | 4 +- lib/apollo-federation/schema.rb | 55 ++++++-- .../service_field_v2_spec.rb | 128 +++++++++--------- 5 files changed, 159 insertions(+), 192 deletions(-) create mode 100644 .github/workflows/semantic-pr-title.yml delete mode 100644 .github/workflows/semantic.yml diff --git a/.github/workflows/semantic-pr-title.yml b/.github/workflows/semantic-pr-title.yml new file mode 100644 index 000000000..66f4260ef --- /dev/null +++ b/.github/workflows/semantic-pr-title.yml @@ -0,0 +1,48 @@ +name: "Semantic PR Title" + +on: + pull_request: + branches: + - main + types: + - opened + - edited + - synchronize + - reopened + +permissions: + pull-requests: write + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true \ No newline at end of file diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml deleted file mode 100644 index 1cde66065..000000000 --- a/.github/workflows/semantic.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: "Semantic Pull Request" - -on: - pull_request: - branches: - - main - -permissions: - pull-requests: write - -jobs: - main: - name: Validate PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5 - id: lint_pr_title - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - uses: marocchino/sticky-pull-request-comment@v2 - # When the previous steps fails, the workflow would stop. By adding this - # condition you can continue the execution with the populated error message. - if: always() && (steps.lint_pr_title.outputs.error_message != null) - with: - header: pr-title-lint-error - message: | - Hey there and thank you for opening this pull request! 👋🏼 - - We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. - - Details: - - ``` - ${{ steps.lint_pr_title.outputs.error_message }} - ``` - - # Delete a previous comment when the issue has been resolved - - if: ${{ steps.lint_pr_title.outputs.error_message == null }} - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - delete: true - - semantic-versioning: - name: Report semantic changelog - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run install - uses: borales/actions-yarn@v4 - with: - cmd: install - - name: Check semantic versioning - id: semantic-release - run: | - GITHUB_REF=${{ github.head_ref }} - npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator --branches ${{ github.head_ref }} > output.txt - OUTPUT=$(cat output.txt | base64 -w 0) - echo "::set-output name=releaseNote::$OUTPUT" - - - name: Report semantic versioning - uses: actions/github-script@v3 - if: ${{ steps.semantic-release.outputs.releaseNote != '' }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - // build release note - const semanticReleaseOutput = Buffer.from('${{ steps.semantic-release.outputs.releaseNote }}', 'base64').toString('utf8'); - const semanticReleaseLogMatch = /^[[0-9:\sAMPM]+\]\s\[semantic-release\].*$/; - const lines = semanticReleaseOutput.split('\n'); - const lastSemanticReleaseLogIndex = [...lines] - .reverse() - .findIndex((line) => line.match(semanticReleaseLogMatch)); - - const releaseNoteIndex = lines.length - lastSemanticReleaseLogIndex; - const releaseNote = lines.slice(releaseNoteIndex); - - let res = releaseNote.join('\n'); - if (!releaseNote.length || !res) { - res = '### No release note would be generated.'; - } - - const SEMANTIC_RELEASE_BODY_HEADER = '## 📝 Semantic Release Report'; - const body = [SEMANTIC_RELEASE_BODY_HEADER, res].join('\n'); - - // get last comment - const comments = await github.issues.listComments({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }); - - // find comments to delete - const commentsToDelete = comments.data.filter((comment) => - comment.body.startsWith(SEMANTIC_RELEASE_BODY_HEADER) - ); - - // delete comments - const prms = commentsToDelete.map((comment) => - github.issues.deleteComment({ - comment_id: comment.id, - owner: context.repo.owner, - repo: context.repo.repo - }) - ); - - await Promise.all(prms); - - // create new comment for release note - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body - }); \ No newline at end of file diff --git a/lib/apollo-federation/federated_document_from_schema_definition.rb b/lib/apollo-federation/federated_document_from_schema_definition.rb index 8d2f13d7d..f3ecd6bd9 100644 --- a/lib/apollo-federation/federated_document_from_schema_definition.rb +++ b/lib/apollo-federation/federated_document_from_schema_definition.rb @@ -100,8 +100,8 @@ def merge_directives(node, type) end def directive_name(directive) - if schema.federation_2? && !Schema::IMPORTED_DIRECTIVES.include?(directive[:name]) - "#{schema.link_namespace}__#{directive[:name]}" + if schema.federation_2? && schema.all_links.none? { |link| link[:import]&.include?(directive[:name]) } + "#{schema.default_link_namespace}__#{directive[:name]}" else directive[:name] end diff --git a/lib/apollo-federation/schema.rb b/lib/apollo-federation/schema.rb index eeb18b205..0b484c9a0 100644 --- a/lib/apollo-federation/schema.rb +++ b/lib/apollo-federation/schema.rb @@ -7,7 +7,7 @@ module ApolloFederation module Schema - IMPORTED_DIRECTIVES = ['inaccessible', 'policy', 'tag'].freeze + IMPORTED_DIRECTIVES = ['composeDirective', 'inaccessible', 'policy', 'tag'].freeze def self.included(klass) klass.extend(CommonMethods) @@ -16,9 +16,11 @@ def self.included(klass) module CommonMethods DEFAULT_LINK_NAMESPACE = 'federation' - def federation(version: '1.0', link: {}) + def federation(version: '1.0', default_link_namespace: nil, links: [], compose_directives: []) @federation_version = version - @link = { as: DEFAULT_LINK_NAMESPACE }.merge(link) + @default_link_namespace = default_link_namespace + @links = links + @compose_directives = compose_directives end def federation_version @@ -37,8 +39,8 @@ def federation_sdl(context: nil) output end - def link_namespace - @link ? @link[:as] : find_inherited_value(:link_namespace) + def default_link_namespace + @default_link_namespace || find_inherited_value(:default_link_namespace, DEFAULT_LINK_NAMESPACE) end def query(new_query_object = nil) @@ -53,6 +55,24 @@ def query(new_query_object = nil) federation_query_object end + def compose_directives + @compose_directives || find_inherited_value(:compose_directives, []) + end + + def links + @links || find_inherited_value(:links, []) + end + + def all_links + imported_directives = IMPORTED_DIRECTIVES + default_link = { + url: "https://specs.apollo.dev/federation/v#{federation_version}", + import: imported_directives, + } + default_link[:as] = default_link_namespace if default_link_namespace != DEFAULT_LINK_NAMESPACE + [default_link, *links] + end + private def original_query @@ -60,13 +80,28 @@ def original_query end def federation_2_prefix - federation_namespace = ", as: \"#{link_namespace}\"" if link_namespace != DEFAULT_LINK_NAMESPACE + schema = ['extend schema'] + + all_links.each do |link| + link_str = ' @link(' + link_str += "url: \"#{link[:url]}\"" + link_str += ", as: \"#{link[:as]}\"" if link[:as] + if link[:import] + imported_directives = link[:import].map { |d| "\"@#{d}\"" }.join(', ') + link_str += ", import: [#{imported_directives}]" + end + link_str += ')' + schema << link_str + end + + compose_directives.each do |directive| + schema << " @composeDirective(name: \"@#{directive}\")" + end - <<~SCHEMA - extend schema - @link(url: "https://specs.apollo.dev/federation/v#{federation_version}"#{federation_namespace}, import: [#{(IMPORTED_DIRECTIVES.map { |directive| "\"@#{directive}\"" }).join(', ')}]) + schema << '' + schema << '' - SCHEMA + schema.join("\n") end def schema_entities diff --git a/spec/apollo-federation/service_field_v2_spec.rb b/spec/apollo-federation/service_field_v2_spec.rb index f1f015ead..a61acb92e 100644 --- a/spec/apollo-federation/service_field_v2_spec.rb +++ b/spec/apollo-federation/service_field_v2_spec.rb @@ -115,7 +115,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { upc: String! @@ -150,7 +150,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends { upc: String! @@ -186,7 +186,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @federation__shareable { x: Int! @@ -223,7 +223,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @inaccessible { x: Int! @@ -260,7 +260,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @tag(name: "private") { x: Int! @@ -297,7 +297,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @policy(policies: [["private"]]) { x: Int! @@ -328,13 +328,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do query query_obj - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__extends { upc: String! @@ -364,13 +364,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do query query_obj - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @fed2__shareable { x: Int! @@ -401,13 +401,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do query query_obj - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @inaccessible { x: Int! @@ -438,13 +438,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do query query_obj - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position @tag(name: "private") { x: Int! @@ -474,13 +474,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do query query_obj - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__key(fields: "upc") { upc: String! @@ -505,13 +505,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do orphan_types product - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__extends @fed2__key(fields: "upc") { price: Int @@ -532,13 +532,13 @@ def execute_sdl(schema) schema = Class.new(base_schema) do orphan_types product - federation version: '2.3', link: { as: 'fed2' } + federation version: '2.3', default_link_namespace: 'fed2' end expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.3", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.3", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__interfaceObject @fed2__key(fields: "id") { id: ID! @@ -587,7 +587,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book implements Product { upc: String! @@ -639,7 +639,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book implements Product { upc: String! @@ -691,7 +691,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book implements Product { upc: String! @@ -754,7 +754,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book implements Product @federation__extends @federation__key(fields: "upc") { upc: String! @federation__external @@ -798,7 +798,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book { upc: String! @@ -836,7 +836,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Book { upc: String! @@ -874,7 +874,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) enum ProductType @policy(policies: [["private"]]) { BOOK @@ -911,7 +911,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) enum ProductType @tag(name: "private") { BOOK @@ -948,7 +948,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) enum ProductType @inaccessible { BOOK @@ -989,7 +989,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { upc: UPC! @@ -1035,7 +1035,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { upc: UPC! @@ -1081,7 +1081,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { upc: UPC! @@ -1131,7 +1131,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1186,7 +1186,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1241,7 +1241,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1296,7 +1296,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1345,7 +1345,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1390,7 +1390,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) """ Autogenerated return type of CreateProduct. @@ -1429,7 +1429,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "upc") { upc: String! @@ -1460,7 +1460,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "upc") { upc: String! @@ -1488,7 +1488,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "upc") @federation__key(fields: "name") { name: String @@ -1514,7 +1514,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "upc", resolvable: false) { upc: String! @@ -1539,7 +1539,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "upc") { upc: String! @@ -1566,7 +1566,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "upc") { price: Int @@ -1593,7 +1593,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "id") { id: ID! @@ -1620,7 +1620,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__interfaceObject @federation__key(fields: "id") { id: ID! @@ -1651,7 +1651,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position { x: Int! @federation__shareable @@ -1687,7 +1687,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position { x: Int! @inaccessible @@ -1723,7 +1723,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position { x: Int! @tag(name: "private") @@ -1759,7 +1759,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Position { x: Int! @tag(name: "private") @tag(name: "protected") @@ -1811,7 +1811,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { type: ProductType! @@ -1867,7 +1867,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { type: ProductType! @@ -1923,7 +1923,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product { type: ProductType! @@ -1959,7 +1959,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "id") { id: ID! @@ -1995,7 +1995,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "upc") { price: Int @@ -2030,7 +2030,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "upc") { price: Int @federation__external @@ -2059,7 +2059,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "productId") { productId: String! @@ -2087,7 +2087,7 @@ def execute_sdl(schema) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "product_id") { options: [String!]! @federation__requires(fields: "my_id") @@ -2120,7 +2120,7 @@ def self.visible?(context) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__extends @federation__key(fields: "upc") { upc: String! @federation__external @@ -2148,7 +2148,7 @@ def self.visible?(context) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @federation__key(fields: "id") { id: ID! @@ -2172,7 +2172,7 @@ def self.visible?(context) end new_base_schema = Class.new(base_schema) do - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' end schema = Class.new(new_base_schema) do @@ -2182,7 +2182,7 @@ def self.visible?(context) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__extends { upc: String! @@ -2210,7 +2210,7 @@ def self.visible?(context) end new_base_schema = Class.new(base_schema) do - federation version: '2.6', link: { as: 'fed2' } + federation version: '2.6', default_link_namespace: 'fed2' query query_obj end @@ -2219,7 +2219,7 @@ def self.visible?(context) expect(execute_sdl(schema)).to match_sdl( <<~GRAPHQL, extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@inaccessible", "@policy", "@tag"]) + @link(url: "https://specs.apollo.dev/federation/v2.6", as: "fed2", import: ["@composeDirective", "@inaccessible", "@policy", "@tag"]) type Product @fed2__extends { upc: String!