Skip to content

refactor: drive JSON/CBOR serde off the data with a load-time wire-name map - #351

Open
jterapin wants to merge 13 commits into
mainfrom
serde-data-driven
Open

refactor: drive JSON/CBOR serde off the data with a load-time wire-name map#351
jterapin wants to merge 13 commits into
mainfrom
serde-data-driven

Conversation

@jterapin

@jterapin jterapin commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Context

This is the first PR in the current schema-serde stack.

V4 currently walks every declared structure member on each request and response and resolves wire names inline. This PR changes JSON and CBOR structure serde to work from the actual payload or input data instead, using a load-time member lookup to recover the same basic shape V3 had.

Follow-up PR #353 builds on this by replacing the temporary global lookup with protocol-aware schema extensions. I still want early feedback on the traversal change itself, which is why I am splitting the work this way.

What changed

  • StructureShape builds a load-time @members_by_wire_name index at add_member, keyed by each member's location_name and jsonName when present.
  • JSON and CBOR structure build/parse now iterate the input values or payload keys and resolve members through that index instead of walking the full member list.
  • XML is unchanged in this PR.

Testing

  • bundle exec rake smithy-schema:spec
  • bundle exec rake smithy-json:spec
  • bundle exec rake smithy-cbor:spec
  • bundle exec rake smithy:spec:unit
  • bundle exec rake smithy:spec:protocols smithy:rbs:protocols
  • bundle exec rake smithy-schema:rbs
  • aws-sdk-ruby-staging protocol validation green for awsJson1_0, awsJson1_1, restJson1, awsQuery, ec2Query, and restXml

Notes

  • The benchmark motivation for this pass is the wide-structure JSON/CBOR hot path, where resolving only the members that actually appear is materially better than walking the full modeled member list every time.
  • PR refactor: use schema extensions for protocol-aware JSON/CBOR naming #353 narrows the naming behavior so jsonName is only used when the active protocol actually requires it.

--
Written with AI assistance and reviewed by jterapin.

@jterapin jterapin changed the title feat: refactor: Drive JSON/CBOR serde off the data with a load-time wire-name map Aug 14, 2026
@jterapin jterapin changed the title refactor: Drive JSON/CBOR serde off the data with a load-time wire-name map refactor: drive JSON/CBOR serde off the data with a load-time wire-name map Aug 20, 2026
@jterapin
jterapin marked this pull request as ready for review August 20, 2026 15:55
@jterapin
jterapin requested a review from a team as a code owner August 20, 2026 15:55
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