Skip to content

Support composing directive argument default values - #312

Merged
n1ru4l merged 7 commits into
mainfrom
directive-default
Jul 22, 2026
Merged

Support composing directive argument default values#312
n1ru4l merged 7 commits into
mainfrom
directive-default

Conversation

@jdolle

@jdolle jdolle commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

closes #311

@jdolle jdolle self-assigned this Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@theguild/federation-composition 0.23.2-alpha-20260722130231-3ee67c77a180e0f4455b005e4f4a55606e24f8cc npm ↗︎ unpkg ↗︎

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for composing directive argument default values in @theguild/federation-composition. Specifically, it updates the directive builder to preserve the defaultValue of directive arguments when they are defined, and includes a comprehensive integration test to verify this behavior. A changeset has also been added. I have no feedback to provide as the changes are clean and well-tested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread __tests__/composition.spec.ts Outdated
Comment thread .changeset/smart-bees-lose.md Outdated

@n1ru4l n1ru4l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with some additional comments!

Comment thread __tests__/composition.spec.ts Outdated
jdolle and others added 5 commits July 21, 2026 13:50
The tests were not correctly asserting the default value behaviour as
the assertions were raising errors due to other invalid subgraph
conflicts.
@n1ru4l
n1ru4l merged commit 32039b3 into main Jul 22, 2026
5 checks passed
@n1ru4l
n1ru4l deleted the directive-default branch July 22, 2026 13:07
n1ru4l pushed a commit that referenced this pull request Jul 22, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @theguild/federation-composition@0.23.2

### Patch Changes

-
[#312](#312)
[`32039b3`](32039b3)
Thanks [@jdolle](https://github.com/jdolle)! - Support composing
directive argument default values. E.g.

    ```graphql
    extend schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.5"
        import: ["@key", "@composeDirective"]
      )
      @link(url: "https://myspecs.dev/access/v1.0", import: ["@access"])
      @composeDirective(name: "@access")

    directive @access(scope: Scope! = PUBLIC) on FIELD_DEFINITION
    enum Scope {
      PUBLIC
      PRIVATE
    }

    type Query {
      hello: String @access
    }
    ```

Previously, the "PUBLIC" default value in the above example would not be
set in the composed result.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fusion composition drops default values on directive-definition arguments

2 participants