refactor: Rename ShapeRef to MemberShape and add target abstraction for SERDE traversal#342
Open
jterapin wants to merge 22 commits into
Open
refactor: Rename ShapeRef to MemberShape and add target abstraction for SERDE traversal#342jterapin wants to merge 22 commits into
jterapin wants to merge 22 commits into
Conversation
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
Renames
ShapeRefback toMemberShapeand introduces a uniformtargetabstraction so codecs can traverse member and non-member shapes the same way. Mechanical/structural only — no behavior change. Trait-resolution improvements are deferred to a follow-up PR. Aligns the shape model with Smithy's own vocabulary (the spec's member shape concept and the target key in the Smithy ASTKey changes
Rename + target abstraction
ShapeRef→MemberShape;.shape/@shape→.target/@target.Shape#targetreturnsself, so a bare shape and aMemberShapeboth respond to.target. Codecs dispatch onnode.targetuniformly — no wrapper needed at the root.Operation slots are bare shapes
operation.input,output, anderrorsnow store the targetedStructureShapedirectly (no-input ops resolve to
Prelude::Unit) instead of aMemberShapewrapper.Consumers read through
.target(which isselffor a shape), so nothing breaks.Codec rework (JSON, CBOR, XML)
shape.is_a?(MemberShape) ? shape : MemberShape.new(...)entry wrapper.shape.target; renamed the dispatch methods tobuild_shape/parse_shapeto align with the
Builder/Parserentry points.DocBuilderoutput buffer renamed@target→@output(avoids colliding with theshape
targetconcept); parser accumulator namedresult.Schema codegen view cleanup
SchemaHelper(shape-id → constant resolution + prelude map);collapsed duplicated
build_members; removed dead duplication.document_utils Serializer / Deserializer
serialize_shape/deserialize_shapedispatch.RBS + repo-wide cleanup
shapes.rbs(Shape#target,input/output/errorsasShape) and eachcodec's
codec.rbs.ref/shape_ref/member_refvocabulary in runtimeconsumers (plugins, handlers, stubbing, param helpers) and specs.
Downstream impact
Once merged, aws-sdk-ruby-staging (
version-4) needs corresponding updates: code thatreads
operation.input.shape/member.shapemust move to.target, and protocolerror-handling that referenced the old accessors needs the
.shape→.targetchange.Validated against the staging protocol tests during development.
Regenerated
projections/weatherandprojections/shapes.