Skip to content

Add AddNodeField option to disable Query.node while keeping the Node interface - #10404

Merged
michaelstaib merged 5 commits into
mainfrom
mst/tag-alignment
Sep 18, 2026
Merged

michaelstaib merged 5 commits into
mainfrom
mst/tag-alignment

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings September 18, 2026 10:24
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels Sep 18, 2026

Copilot AI 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.

🟢 Approval recommended

Only non-blocking test naming nits remain; the implementation, documentation, and coverage are complete.

Pull request overview

Adds the AddNodeField option to control Relay root fields while preserving the Node interface and resolver support.

Changes:

  • Adds and documents AddNodeField.
  • Updates conditional Relay field and directive registration.
  • Adds schema, resolver, and snapshot coverage.
File summaries
File Summary
website/content/docs/hotchocolate/server/options.md Documents Relay options.
website/content/docs/hotchocolate/defining-a-schema/relay.md Documents interface-only Relay usage.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/RelaySchemaTests.cs Tests generated schema variations.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs Tests resolver behavior without root fields.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/RelaySchemaTests.AddGlobalObjectIdentification_Without_Node_Field.snap Captures the schema without Query.node.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/RelaySchemaTests.AddGlobalObjectIdentification_Without_Node_Field_MarkNodeFieldAsLookup_Is_NoOp.snap Captures lookup directive behavior.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/RelaySchemaTests.AddGlobalObjectIdentification_Without_Node_And_Nodes_Fields.snap Captures the schema without Relay root fields.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeResolverTests.NodeResolver_ResolveNode_Without_Node_And_Nodes_Fields.snap Captures node resolution results.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeResolverTests.NodeResolver_QueryField_Without_Node_And_Nodes_Fields.snap Captures query field behavior.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeResolverTests.NodeResolver_InvalidId_Without_Node_And_Nodes_Fields.snap Captures invalid ID handling.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeResolverTests.NodeAttribute_Type_Builds_Without_Node_And_Nodes_Fields.snap Captures node attribute schema output.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeResolverTests.ImplementsNode_ResolveNode_Type_Builds_Without_Node_And_Nodes_Fields.snap Captures ImplementsNode schema output.
src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs Conditionally registers Relay fields and directives.
src/HotChocolate/Core/src/Types/Types/Relay/GlobalObjectIdentificationOptions.cs Adds the AddNodeField option.
Review details

Suppressed comments (8)

src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs:346

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name describes setup rather than the schema outcome. Rename it to make the behavior explicit.
    public async Task NodeResolver_QueryField_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs:366

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name describes setup rather than the resolution outcome. Rename it to make the behavior explicit.
    public async Task NodeResolver_ResolveNode_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs:434

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name describes setup rather than the build outcome. Rename it to make the behavior explicit.
    public async Task ImplementsNode_ResolveNode_Type_Builds_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs:390

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name does not identify the asserted error outcome. Rename it to make the behavior explicit.
    public async Task NodeResolver_InvalidId_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs:414

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name describes setup rather than the build outcome. Rename it to make the behavior explicit.
    public void NodeAttribute_Type_Builds_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/RelaySchemaTests.cs:55

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; this name does not state the expected outcome and condition clearly. Rename it to make the behavior explicit.
    public async Task AddGlobalObjectIdentification_Without_Node_Field()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/RelaySchemaTests.cs:71

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name omits the expected outcome and uses an ambiguous condition phrase. Rename it to make the behavior explicit.
    public async Task AddGlobalObjectIdentification_Without_Node_And_Nodes_Fields()

src/HotChocolate/Core/test/Types.Tests/Types/Relay/RelaySchemaTests.cs:91

  • Please follow the repository's Method_Should_Outcome_When_Condition test naming convention here; the current name does not clearly separate the expected no-op outcome from its condition. Rename it to make the behavior explicit.
    public async Task AddGlobalObjectIdentification_Without_Node_Field_MarkNodeFieldAsLookup_Is_NoOp()
  • Files reviewed: 14/14 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@michaelstaib
michaelstaib merged commit e01443d into main Sep 18, 2026
4 of 5 checks passed
@michaelstaib
michaelstaib deleted the mst/tag-alignment branch September 18, 2026 10:29
@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (20/20)

File Covered Changed Patch %
…/src/Types/Types/Relay/GlobalObjectIdentificationOptions.cs 1 1 100.0% 🟢
…/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs 19 19 100.0% 🟢

Project coverage: 58.0% (288956/498393 lines)

This was referenced Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants