Repository navigation
Add AddNodeField option to disable Query.node while keeping the Node interface - #10404
Conversation
There was a problem hiding this comment.
🟢 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_Conditiontest 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_Conditiontest 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_Conditiontest 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_Conditiontest 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_Conditiontest 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_Conditiontest 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_Conditiontest 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_Conditiontest 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.
Patch coverage100.0% of changed lines covered (20/20)
Project coverage: 58.0% (288956/498393 lines) |
No description provided.