Skip to content

fix: REQUIRED_INACCESSIBLE with default values#299

Open
n1ru4l wants to merge 3 commits intomainfrom
fix-required-inaccessible-default-value
Open

fix: REQUIRED_INACCESSIBLE with default values#299
n1ru4l wants to merge 3 commits intomainfrom
fix-required-inaccessible-default-value

Conversation

@n1ru4l
Copy link
Copy Markdown
Contributor

@n1ru4l n1ru4l commented Apr 20, 2026

Fix REQUIRED_INACCESSIBLE composition rule reporting a composition error if @inaccessible is applied on a non-nullable field with a default value.

In the following example schema the Query.ping(message:) argument no longer raises REQUIRED_INACCESSIBLE, as a default value for the argument is provided. The same behaviour applies for input type fields.

extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.9"
    import: ["@inaccessible"]
  )

  type Query {
    ping(message: String! = "pong" @inaccessible): String!
  }

Copy link
Copy Markdown
Contributor

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

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 new test cases to REQUIRED_INACCESSIBLE.spec.ts to verify that the @inaccessible directive is permitted on required arguments and input fields when a default value is provided. The reviewer noted that these tests currently fail and will break the CI pipeline. To address this, it is recommended to either update the RequiredArgumentOrFieldIsNotInaccessibleRule validation logic to check for default values or mark the tests with test.todo() or test.fails() to keep the CI green.

Comment thread __tests__/supergraph/errors/REQUIRED_INACCESSIBLE.spec.ts
@n1ru4l n1ru4l changed the title add failing test for REQUIRED_INACCESSIBLE with default values fix: REQUIRED_INACCESSIBLE with default values Apr 20, 2026
@n1ru4l n1ru4l marked this pull request as ready for review April 20, 2026 11:24
@github-actions
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.22.3-alpha-20260420112644-a174fe2b2b471cb99c3bb99818ca0844b7bf3f0d npm ↗︎ unpkg ↗︎

Copy link
Copy Markdown
Member

@dotansimha dotansimha left a comment

Choose a reason for hiding this comment

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

LGTM. But let's wait for @kamilkisiela 's review as well, as he might have broader context than me on this one :)

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.

2 participants