| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
MergeSchemas only errored on a type conflict when both members declared a type; otherwise it kept the first member's type, silently discarding the second's. Because allOf members merge pairwise in order, the generated Go shape depended on member ordering. Format had the mirror-image problem: any mismatch errored, including set-vs-unset, which broke the allOf decorator idiom over refs to format-carrying scalars. Both now follow the same rule: when exactly one member declares a type/format it propagates to the merged schema; when both declare and they differ, the existing errors remain. Fixes oapi-codegen#2524 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryThe PR makes the current allOf merger propagate a type or format declared by only one member while preserving errors for conflicting declarations.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or maintainability issues identified. The merge logic handles absent declarations symmetrically, retains conflict errors when both members declare incompatible values, preserves the legacy compatibility path, and includes focused unit and generated-output regression coverage. Important Files Changed
Reviews (1): Last reviewed commit: "Propagate one-sided type and format in a..." | Re-trigger Greptile |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #2524.
Problem
mergeOpenapiSchemas only errored on a type conflict when both members declared a type; otherwise it kept the first member's type, silently discarding the second's. Because allOf members merge pairwise in order, the generated Go shape depended on member ordering (see the issue for the repro — a struct in one order, any in the other).
Format had the mirror-image problem: any mismatch errored, including set-vs-unset, so the allOf decorator idiom over a $ref to a format-carrying scalar failed generation outright:
Fix
Both fields now follow the same one-sidedness rule: when exactly one member declares a type/format, it propagates to the merged schema; when both declare and they differ, the existing errors remain.
Compatibility notes
Tests
make tidy && make test && make generate && make lint all pass.
🤖 Generated with Claude Code