[Docs] Update v16 migration guide#9123
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the HotChocolate v16 migration guide to document breaking changes around OperationResult construction/mutation and a rename in runtime type abstractions.
Changes:
- Added guidance for replacing usages of
OperationResultBuilder(now internal) with directOperationResultconstruction and immutable updates. - Documented
OperationResultAPI changes (removal ofIOperationResult, non-nullErrors/Extensions). - Added note about renaming
IHasRuntimeTypetoIRuntimeTypeProvider.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```csharp | ||
| var errors = ImmutableList.Create<IError>([]); | ||
| var extensions = ImmutableOrderedDictionary.Create([]); | ||
|
|
||
| context.Result = new OperationResult(errors, extensions); | ||
| ``` |
There was a problem hiding this comment.
The sample constructs an OperationResult with empty errors and empty extensions. In v16 OperationResult(ImmutableList<IError> errors, ...) throws when errors.Count == 0, and the other constructor also rejects having no data + no errors + no extensions. Update the snippet to show a valid construction (e.g., provide at least one error, or create the result with non-empty extensions, or include data).
|
|
||
| ```csharp | ||
| var errors = ImmutableList.Create<IError>([]); | ||
| var extensions = ImmutableOrderedDictionary.Create([]); |
There was a problem hiding this comment.
ImmutableOrderedDictionary.Create([]) will not compile as written because the generic type arguments cannot be inferred from an empty collection expression. Use ImmutableOrderedDictionary<string, object?>.Empty or specify the generic arguments explicitly (e.g., Create<string, object?>(...)).
| var extensions = ImmutableOrderedDictionary.Create([]); | |
| var extensions = ImmutableOrderedDictionary<string, object?>.Empty; |
| } | ||
| ``` | ||
|
|
||
| Most of the properties you'd want to modify are now immutable data structures that can be modified. |
There was a problem hiding this comment.
This sentence reads self-contradictory: “immutable data structures that can be modified.” Consider clarifying that these are immutable collections updated via non-destructive operations (e.g., SetItem returns a new instance) to avoid confusion for readers.
| Most of the properties you'd want to modify are now immutable data structures that can be modified. | |
| Most of the properties you'd want to change now expose immutable collection types; use their non-destructive update methods (for example, `SetItem` returns a new instance) and assign the returned value back to the property. |
6499651 to
3eeaba6
Compare
🚀 Fusion Gateway Performance ResultsSimple Composite QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
}
}
}
}Deep Recursion QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
users {
...User
reviews {
...Review
product {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}
}
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}Variable Batching ThroughputConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query query TestQuery_8f7a46ce_2(
$__fusion_1_upc: ID!
$__fusion_2_price: Long!
$__fusion_2_weight: Long!
) {
productByUpc(upc: $__fusion_1_upc) {
inStock
shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
}
}Variables (5 sets batched in single request) [
{ "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
{ "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
{ "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]No baseline data available for comparison. Run 22104598531 • Commit 11f7e10 • Tue, 17 Feb 2026 15:49:18 GMT |
No description provided.