Repository navigation
Add batch and cache DataLoader interfaces - #10305
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “kind” marker interfaces for GreenDonut data loaders (batch vs. cache) and introduces a generic DataLoaderAttribute<T> variant, with tests to lock in the intended API surface.
Changes:
- Add
IBatchDataLoader<TKey, TValue>andICacheDataLoader<TKey, TValue>marker interfaces in GreenDonut.Abstractions. - Update
BatchDataLoader/StatefulBatchDataLoaderandCacheDataLoader/StatefulCacheDataLoaderto implement the corresponding marker interfaces. - Add
DataLoaderAttribute<T>plus unit tests validating interface implementation and attribute property behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/GreenDonut/test/GreenDonut.Tests/DataLoaderKindInterfaceTests.cs | Adds tests asserting batch/cache loader base types implement the new marker interfaces. |
| src/GreenDonut/test/GreenDonut.Tests/DataLoaderAttributeTests.cs | Adds tests for DataLoaderAttribute<T> property configuration and defaults. |
| src/GreenDonut/src/GreenDonut/CacheDataLoader.cs | Implements ICacheDataLoader<TKey, TValue> on cache data loader base types. |
| src/GreenDonut/src/GreenDonut/BatchDataLoader.cs | Implements IBatchDataLoader<TKey, TValue> on batch data loader base types. |
| src/GreenDonut/src/GreenDonut.Abstractions/ICacheDataLoader.cs | Introduces cache “kind” marker interface. |
| src/GreenDonut/src/GreenDonut.Abstractions/IBatchDataLoader.cs | Introduces batch “kind” marker interface. |
| src/GreenDonut/src/GreenDonut.Abstractions/Attributes/DataLoaderAttribute~1.cs | Adds generic DataLoaderAttribute<T> for generator-facing metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage93.1% of changed lines covered (1386/1488) +2 more changed files; see the JSON below for uncovered lines. Uncovered changed lines (JSON){
"sha": "e6a1aaab9c57eaba496010c00c4bff9eb25c2a18",
"files": [
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/Helpers/DataLoaderAttributeHelper.cs", "ranges": [[297, 297], [304, 304], [306, 306]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/Models/GenericDataLoaderInfo.cs", "ranges": [[63, 63], [75, 75], [77, 77], [79, 79], [83, 83], [93, 93], [106, 106], [108, 119], [121, 127], [129, 129], [275, 275], [278, 278], [386, 386], [389, 389], [392, 392], [395, 398], [401, 403], [406, 409]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderMultipleAttributesCodeFixProvider.cs", "ranges": [[34, 35], [45, 46], [66, 67]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderMissingInterfaceImplementationAnalyzer.cs", "ranges": [[92, 93], [100, 101], [113, 114], [122, 123], [147, 148], [227, 232], [256, 257], [264, 264], [354, 354]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderKeyParameterCodeFixProvider.cs", "ranges": [[18, 18], [22, 22], [59, 60]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/GenericDataLoaderAnalyzerHelper.cs", "ranges": [[22, 23], [67, 68], [128, 129], [197, 198], [255, 256], [258, 258], [277, 278]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/Generators/DataLoaderModuleGenerator.cs", "ranges": [[24, 25]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderReturnTypeCodeFixProvider.cs", "ranges": [[18, 18], [22, 22], [60, 61]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/GenericDataLoaderMethodAnalyzer.cs", "ranges": [[31, 32]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderReturnTypeAnalyzer.cs", "ranges": [[31, 32]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/DataLoaderKeyParameterAnalyzer.cs", "ranges": [[31, 32]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/Inspectors/DataLoaderInspector.cs", "ranges": [[44, 44]] }
]
}Project coverage: 57.6% (285257/494960 lines) |
This was referenced Oct 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.