Skip to content

Fix JSON 3 message generation - #27

Merged
samuel-williams-shopify merged 3 commits into
mainfrom
fix-json-coder-options
Sep 8, 2026
Merged

Fix JSON 3 message generation#27
samuel-williams-shopify merged 3 commits into
mainfrom
fix-json-coder-options

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the built-in JSON coder’s behavior explicit: incoming object keys are symbolized, while outgoing messages use plain JSON.generate. This prevents parser-only symbolize_names from being passed to JSON 3’s generator.

Protocol::WebSocket::Coder::JSON is now a stateless module and is itself the default coder, removing the redundant JSON::DEFAULT instance. Applications needing different serialization behavior can pass any coder responding to parse and generate.

Migration

Replace uses of Protocol::WebSocket::Coder::JSON.new(...) or JSON::DEFAULT with Protocol::WebSocket::Coder::JSON. Use a custom coder when different JSON options are required.

Validation

  • 96 tests pass (161 assertions)
  • Direct JSON 3.0.1 reproduction passes
  • RuboCop passes
  • Documentation coverage remains 100%

Assisted-By: devx/7ef83274-928f-499d-b668-48449b1ff60e
Assisted-By: devx/7ef83274-928f-499d-b668-48449b1ff60e
Assisted-By: devx/7ef83274-928f-499d-b668-48449b1ff60e
@samuel-williams-shopify samuel-williams-shopify changed the title Separate JSON parse and generate options Fix JSON 3 message generation Sep 8, 2026
@samuel-williams-shopify
samuel-williams-shopify merged commit 667b042 into main Sep 8, 2026
36 of 42 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the fix-json-coder-options branch September 8, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant