feat: consider edge custom serde cases#6
Open
tisonkun wants to merge 3 commits into
Open
Conversation
Signed-off-by: tison <wander4096@gmail.com>
Normalize union alternatives, encode field placement independently from opaque custom boundaries, and retain custom variant content metadata. Add real Serde compatibility tests for flatten, transparent fields, and custom variants. Signed-off-by: tison <wander4096@gmail.com>
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
ShapeRef::Unionvalues for format-native alternatives;Value,Flatten,Inline, andOmittedwire positions;ShapeRef::Opaque, including flattened and transparent combinations;Design notes
Union alternatives may overlap. Construction through
ShapeRef::unionorShapeRef::try_unionflattens nested unions, removes duplicates, sorts alternatives into canonical order, collapses singletons, and rejects empty input. The central public shape enums are non-exhaustive so future model additions do not require exhaustive downstream matches.Field placement and value knowledge are independent: custom boundaries use
ShapeRef::Opaque, so valid Serde combinations such asflatten + withbecomeFlatten(Opaque(...)), while transparent custom fields becomeInline(Opaque(...)). Redundant field and variant booleans are removed so the wire model has one source of truth.Compatibility
This PR changes the public shape model. Consumers should migrate from
value_shapeand the separateskip,flatten, and custom flags toFieldWireShape; variant consumers should use the new direction-specific variant content enums.ShapeRef::OneOfis replaced by normalizedShapeRef::Unionvalues created through the union constructors.Validation
cargo x testcargo +1.85.0 x testcargo x lintcargo x build --lockedflatten + with, named transparent fields,transparent + with, and variant-level custom handlers