ChilliCream / ChilliCream/graphql-platform
Document serialization behavior when passing object to ErrorBuilder.SetExtension
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Product
Hot Chocolate
Is your feature request related to a problem?
When adding a custom extension to an error, it's serialized by default using a format I don't recognize. But when a JsonElement is used instead, it's reliably serialized using JSON.
Case 1:
IError err = ErrorBuilder.New()
.SetCode("TEST")
.SetMessage("Test message.")
.SetExtension("testExtension", new { prop = "val" })
.Build();
// "extensions": {
// "code": "TEST",
// "testExtension": "{ prop = val }"
// }
Case 2:
IError err = ErrorBuilder.New()
.SetCode("TEST")
.SetMessage("Test message.")
.SetExtension("testExtension", JsonSerializer.SerializeToElement(new { prop = "val" }))
.Build();
// "extensions": {
// "code": "TEST",
// "testExtension": {
// "prop": "val"
// }
// }
The solution you'd like
Could this behavior be documented at https://chillicream.com/docs/hotchocolate/v14/api-reference/error-filter?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the Hot Chocolate v14 error-filter documentation at the linked page and compare the two SetExtension examples in the issue. Document how object values and JsonElement values are serialized, including the resulting shape, so readers can choose the intended form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100