refactor: use schema extensions for protocol-aware JSON/CBOR naming - #353
Open
jterapin wants to merge 23 commits into
Open
refactor: use schema extensions for protocol-aware JSON/CBOR naming#353jterapin wants to merge 23 commits into
jterapin wants to merge 23 commits into
Conversation
jterapin
force-pushed
the
schema-extensions
branch
from
August 19, 2026 22:52
ca43cbb to
3cd9d5b
Compare
jterapin
force-pushed
the
schema-extensions
branch
from
August 20, 2026 15:43
bdaeb0f to
7cdb5a0
Compare
jterapin
marked this pull request as ready for review
August 20, 2026 15:55
jterapin
force-pushed
the
schema-extensions
branch
from
August 20, 2026 19:20
26eb64d to
1cfdee8
Compare
richardwang1124
approved these changes
Aug 24, 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.
Context
This is the second PR in the stack and should be reviewed on top of #351.
PR #351 moved JSON and CBOR structure serde onto the actual input or payload data, but the follow-up lookup path was still protocol-blind and relied on temporary normalization. This PR moves that lookup behavior behind explicit schema and JSON extension helpers.
What changed
Smithy::Schema::Extensionfor generic modeled-member lookup and shared trait helpers.Smithy::Json::ExtensionforjsonName-aware lookup used only when JSON serde opts intojson_namebehavior.shape[:member_index].shape[:json_index].member[:json_name].MemberShape#nameas the modeled member name and updated generated schema emission accordingly.jsonNamehandling through the same extension helpers.sparse?handling toSmithy::Schema::Extension, with JSON delegating to it.Behavior after this change
json_name: trueusesjsonName.json_name: falseuses the modeled member name.__typeis only preserved when it is explicitly modeled throughjsonName.Explicit non-goals
Compatibility note
MemberShape#initializestill acceptslocation_name:as a temporary fallback for downstream stacked work and existing generated projections.Validation
bundle exec rspec gems/smithy-schema/spec gems/smithy-json/spec gems/smithy/spec/interfaces/schema/serde_traits_spec.rbbundle exec smithy build --debugPerformance Summary
JSON Wins And Regressions
Top JSON Wins
GetItemresponse with binary-heavy payload:16.4%lower mean latency on Graviton,10.4%lower on IntelPutItemrequest:14.0%lower mean latency on Intel,13.4%lower on GravitonPutItemrequest with binary payload:13.4%lower mean latency on Intel,10.2%lower on GravitonGetItemresponse:12.7%lower mean latency on Intel,7.2%lower on GravitonGetItemresponse:11.3%lower mean latency on Graviton,8.2%lower on IntelNotes:
GetItem/PutItemscenarios, especially baseline and binary-heavy payloads.>=5%wins, while Graviton still improves on the largest JSON cases.Top JSON Regressions
15.4%higher mean latency on Intel,10.4%higher on Graviton7.4%higher mean latency on GravitonGetItemresponse payload:4.6%higher mean latency on IntelNotes:
+5%threshold.CBOR Wins And Regressions
Top CBOR Wins
PutItemrequest with binary payload:9.2%lower mean latency on IntelPutItemrequest:8.4%lower mean latency on Intel,6.7%lower on GravitonGetItemresponse:6.0%lower mean latency on Intel,5.5%lower on GravitonPutItemrequest:5.4%lower mean latency on IntelNotes:
PutItemrequest shapes, but the overall effect is modest rather than dramatic.1.4%lower and p99 latency is2.2%lower, so most results still cluster close to baseline.Top CBOR Regressions
+5%regression threshold.--
Written with AI assistance and reviewed by jterapin.