ChilliCream / ChilliCream/graphql-platform
Example serializer from the Strawberry Shake documentation doesn't work
Open
Nobody has claimed this yet.
🌶️ strawberry shake
Area: Scalars
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Product
Strawberry Shake
Version
13.9.14
Link to minimal reproduction
https://filebin.net/gs6gkxscspus013d/GraphQlSerializerIssue.zip
Steps to reproduce
- Go to https://chillicream.com/docs/strawberryshake/v13/scalars#any-or-json
- Copy the example serializer:
public class MyJsonSerializer : ScalarSerializer<JsonElement, object>
{
public MyJsonSerializer(string typeName = BuiltInScalarNames.Any)
: base(typeName)
{
}
public override object Parse(JsonElement serializedValue)
{
// handle the serialization of the JsonElement
}
protected override JsonElement Format(object runtimeValue)
{
// handle the serialization of the runtime representation in case
// the scalar is used as a variable.
}
}
- Paste in a new class
- You'll get an error on
protected override JsonElement Format(object runtimeValue) - It is impossible to implement this method; it gives compiler error CS0462 since it tries to override two methods:
protected abstract TSerialized Format(TRuntime runtimeValue);
public object? Format(object? runtimeValue)
What is expected?
A working example
What is actually happening?
Compiler error
Relevant log output
No response
Additional context
No response
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
Start with the Strawberry Shake v13 “Any or JSON” documentation page and the linked minimal reproduction, then inspect the shown ScalarSerializer example and its compiler error. Confirm the documented serializer example compiles without CS0462 and that the corrected example still demonstrates the intended serialization behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, graphql
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100