Repository navigation
fix: preserve Go allOf object composition - #181
Open
adamcavendish wants to merge 1 commit into
Open
adamcavendish wants to merge 1 commit into
adamcavendish wants to merge 1 commit into
Conversation
- Compose compatible object and map members as flat JSON instead of embedding anonymous map syntax that cannot compile or inheriting a sibling-hiding codec. - Retain named member entrypoints and promoted fields, naming anonymous maps and disambiguating repeated members and storage collisions without wire wrappers. - Project declared keys to their owning members so extension maps do not retain stale copies, and reject conflicting member encodings instead of overwriting. - Follow aliases and nested object facts with cached, deduplicated metadata so repeated composition references do not expand every path through the graph. - Offer composed and raw policies, preserving non-object, incompatible and cyclic intersections as json.RawMessage rather than emitting invalid or lossy models. - Retain ordinary encoding/json member behavior and typed HTTP request, success and lazy error payloads through structured model and method emission. - Run native Go consumers through the golden build entrypoint alongside exact render, versioned IR and golden contracts on untouched generated projects. - Keep ordinary object and dictionary codecs, shared lowering, other generators, generated dependencies and formatting redesign outside this Go repair.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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
Generate compiling, flat-wire Go
allOfobject/map models while retaining namedmember entrypoints. Add a raw JSON escape hatch for compositions that cannot be
represented conservatively as objects.
Problem
The Go emitter embedded every intersection member, including anonymous maps,
producing invalid
map[string]anystruct fields. Merely naming the map is notenough: JSON methods promoted from one embedded object can hide sibling fields.
Behavior
json.RawMessagealiasall_of_strategy = "raw"Compatibility
The default
composedpolicy follows retained object/map facts through aliasesand nested intersections. Existing named member struct literals and field access
remain available; anonymous map storage was previously uncompilable. Duplicate
member names receive suffixes instead of invalid duplicate embeddings.
Non-object, incompatible and unproductive cyclic intersections now use
json.RawMessage; consumers of those previous representations should regenerateand update their construction code. Explicit raw mode intentionally does not
enforce intersection constraints and retains JSON kinds, nulls and exact numbers.
This is conservative representation planning, not a complete JSON Schema
validator. Ordinary member codecs, null/optional handling and Go's dynamic
anyfloating-point behavior remain unchanged. Conflicting writes are compared by
their JSON encodings rather than by a schema-level equivalence relation.
Boundaries
Go only. Shared lowering, ordinary object/dictionary codecs, untagged unions,
JVM composition, generated dependencies and generation formatting are unchanged.
Native consumers run directly through the Go golden-build entrypoint without
patching generated source or spawning build tools from tests.