Skip to content

Commit 014b2e2

Browse files
authoredDec 14, 2021
Mutation Documentation Refinements (#4558)
1 parent f048c8d commit 014b2e2

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
 

‎website/src/blog/2021-12-14-hot-chocolate-12-4/2021-09-27-hot-chocolate-12-4.md

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ services
257257
})
258258
```
259259

260+
> Note: You can also partially opt-out of the convention by for instance crafting your own input type but letting the convention produce the payload.
261+
260262
## Errors
261263

262264
The second part of this new mutation convention involves user errors. We did a lot of work investigating how we should enable errors or even what pattern we should follow.

‎website/src/docs/hotchocolate/defining-a-schema/mutations.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ type UpdateUserNamePayload {
223223

224224
Following this pattern helps to keep the schema evolvable but requires a lot of boilerplate code to realize.
225225

226-
## Introduction
226+
## Input and Payload
227227

228228
HotChocolate has built-in conventions for mutations to minimize boilerplate code.
229229

@@ -349,7 +349,7 @@ type Mutation {
349349
</ExampleTabs.Schema>
350350
</ExampleTabs>
351351

352-
## Defining Errors
352+
## Errors
353353

354354
The mutation conventions also allow you to create mutations that follow the error
355355
[stage 6a Pattern Marc-Andre Giroux layed out](https://xuorig.medium.com/a-guide-to-graphql-errors-bb9ba9f15f85) with minimal effort.
@@ -958,6 +958,15 @@ public UpdateUserNamePayload UpdateUserNameAsync(UpdateUserNameInput input)
958958
}
959959
```
960960

961+
You can also partially opt-out:
962+
963+
```csharp
964+
public User UpdateUserNameAsync(UpdateUserNameInput input)
965+
{
966+
//...
967+
}
968+
```
969+
961970
### Custom error interface
962971

963972
Lastly, we can customize the error interface we want to use with our mutation convention. The error interface is shared across all error types that the schema defines and provides the minimum shape that all errors have to fulfill.

0 commit comments

Comments
 (0)
Please sign in to comment.