refactor: use schema extensions for protocol-aware JSON/CBOR naming - #353
Open
jterapin wants to merge 14 commits into
Open
refactor: use schema extensions for protocol-aware JSON/CBOR naming#353jterapin wants to merge 14 commits into
jterapin wants to merge 14 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
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 introduced a temporary reverse lookup on
StructureShapeso JSON and CBOR structure serde could operate on the actual payload or input data. That lookup is protocol-blind: ajsonNamewire key can resolve even when the active protocol should be using the modeled member name instead.This PR replaces that stopgap with lazy, protocol-aware naming resolution for JSON and CBOR.
What changed
Smithy::Schema::Extensionfor lazy member indexes keyed by modeled member names.Smithy::Json::ExtensionforjsonName-aware lookup used only when JSON serde opts intojson_namebehavior.MemberShapenow usesmodel_nameas the primary modeled member identity.model_name:and symbolized serde trait keys needed by the new lookup path.Behavior after this change
json_name: trueusesjsonNamejson_name: falseuses the modeled member name__typeis only preserved when it is explicitly modeled throughjsonNameExplicit non-goals
Compatibility note
MemberShape#initializestill falls back frommodel_name:tolocation_name:for downstream compatibility. That fallback is currently needed because some downstream Query/XML wrapper-member paths still construct members withlocation_name:.Testing
bundle exec rake smithy-schema:specbundle exec rake smithy-json:specbundle exec rake smithy-cbor:specbundle exec rake smithy:spec:unitbundle exec rake smithy:spec:protocols smithy:rbs:protocolsbundle exec rake smithy-schema:rbs--
Written with AI assistance and reviewed by jterapin.