Serialize sbyte values as JSON numbers in StrawberryShake#9827
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes StrawberryShake JSON variable/extension serialization for Byte! (runtime sbyte in v16) by ensuring sbyte values are emitted as JSON numbers instead of quoted strings, restoring compatibility with v16 GraphQL servers.
Changes:
- Add explicit
sbytehandling toJsonSerializationHelper.WriteValueso boxedsbytevalues serialize as JSON numbers. - Add a targeted unit test asserting
sbyteserializes to an unquoted JSON number. - Extend the existing “extensions numeric matrix” snapshot test to include
SByte.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/StrawberryShake/Client/src/Core/Json/JsonSerializationHelper.cs |
Adds sbyte case to write numeric JSON output instead of falling back to string serialization. |
src/StrawberryShake/Client/test/Core.Tests/Json/JsonSerializationHelperTests.cs |
Adds a focused unit test covering sbyte numeric serialization. |
src/StrawberryShake/Client/test/Core.Tests/Json/JsonOperationRequestSerializerTests.cs |
Extends the extensions serialization test to include an SByte entry. |
src/StrawberryShake/Client/test/Core.Tests/Json/__snapshots__/JsonOperationRequestSerializerTests.Serialize_Request_With_Extensions.snap |
Updates snapshot to reflect SByte being serialized as a JSON number. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 3, 2026
This was referenced Jun 5, 2026
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.
Summary
Byte!variables were serialized as JSON strings ("2") instead of numbers (2), causing v16 servers to reject them.ByteSerializerbecameScalarSerializer<sbyte>in v16, butJsonSerializationHelper.WriteValuehad nosbytecase, so values fell through to string serialization.sbytecase (placed besidebyte, signed-before-unsigned to match the existing 16/32/64-bit pairs).Test plan
JsonSerializationHelperTests.WriteSByteAsNumberverifyingsbyteserializes as a JSON number.SByteentry to the comprehensiveSerialize_Request_With_Extensionsnumeric-matrix snapshot test.Closes #9825