Skip to content

Conversation

@hugo-vrijswijk
Copy link
Contributor

@hugo-vrijswijk hugo-vrijswijk commented Nov 14, 2025

As of september 2025 @oneOf is a built-in directive: https://spec.graphql.org/September2025/#sec--oneOf

This PR adds that to the definition list, so schemas using it will work without errors

@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

🦋 Changeset detected

Latest commit: 0baf2b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@graphql-tools/import Patch
@graphql-tools/graphql-file-loader Patch
@graphql-tools/node-require Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for the oneOf directive as a built-in directive in schema imports.

Summary by CodeRabbit

  • New Features
    • Added oneOf directive to the list of built-in GraphQL directives, enabling proper schema handling and validation for input types using this specification.

Walkthrough

Registers the oneOf directive in the builtinDirectives array and updates tests and fixtures: adds input D annotated with @oneOf, and changes C.id from ID! to D! in test fixtures and expected SDL.

Changes

Cohort / File(s) Summary
Core directive registration
packages/import/src/index.ts
Added 'oneOf' to the builtinDirectives array (inserted after specifiedBy and before federation directives).
New test input type
packages/import/tests/schema/fixtures/input-types/d.graphql
Added new input D annotated with @oneOf containing field1: ID and field2: Int.
Updated test fixture referencing D
packages/import/tests/schema/fixtures/input-types/c.graphql
Imported D and changed C.id from ID! to D!.
Test expectations updated
packages/import/tests/schema/import-schema.spec.ts
Updated expected SDL to include input D with @oneOf and adjusted C's field type to D.
Release notes / changeset
.changeset/early-parents-behave.md
Added changeset noting the addition of oneOf to built-in directives.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Tests as Test Suite
  participant ImportPkg as `@graphql-tools/import`
  participant Fixtures as Schema Fixtures

  Note over ImportPkg: builtinDirectives updated\n(includes `oneOf`)
  Tests->>Fixtures: read fixtures (`c.graphql`, `d.graphql`)
  Tests->>ImportPkg: importSchema(fixtures)
  ImportPkg->>ImportPkg: include builtinDirectives (contains `oneOf`)
  ImportPkg-->>Tests: produce SDL (input `D `@oneOf``, `C.id` -> `D!`)
  Note over Tests,ImportPkg: verify expected SDL
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-line change in packages/import/src/index.ts plus additions/updates to test fixtures and expectations.
  • Areas to check:
    • Correct insertion/order of 'oneOf' among builtin directives in packages/import/src/index.ts.
    • Test SDL expectations in packages/import/tests/schema/import-schema.spec.ts match the new @oneOf annotation and updated C type.
    • Ensure new fixture d.graphql complies with schema formatting/lint rules.

Possibly related PRs

Suggested reviewers

  • ardatan

Poem

🐇 OneOf hops into the list tonight,
D springs fields under moonlight.
C trades an ID for D's gentle cheer,
Tests nod softly — all is clear. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add oneOf to built-in directives' directly and clearly summarizes the main change in the changeset.
Description check ✅ Passed The description explains that @OneOf became a built-in directive in September 2025 and this PR adds it to the definitions so schemas using it work without errors, which is directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef935d and 0baf2b0.

📒 Files selected for processing (1)
  • .changeset/early-parents-behave.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Unit Test on Node 18 (ubuntu-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 24 (ubuntu-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 18 (windows-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 22 (ubuntu-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 18 (ubuntu-latest) and GraphQL v15
  • GitHub Check: Unit Test on Bun
  • GitHub Check: Full Check on GraphQL v16
🔇 Additional comments (1)
.changeset/early-parents-behave.md (1)

1-5: LGTM!

The changeset file is well-formed and appropriately captures the change. The patch version bump is correct for an additive, non-breaking change (adding @oneOf to built-in directives), and the description clearly communicates the purpose.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hugo-vrijswijk
Copy link
Contributor Author

I'm not exactly sure why the Bun tests are failing. I haven't changed any code related to the failing test

@ardatan ardatan merged commit 8a2a507 into ardatan:master Nov 16, 2025
14 of 15 checks passed
@ardatan
Copy link
Owner

ardatan commented Nov 16, 2025

It is ok. It is our end! Thanks for the PR!

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