GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — Propagate one-sided type and format in allOf merges by mromaszewicz · Pull Request #2526 · oapi-codegen/oapi-codegen Conversation
Member
Fixes #2524. Problem
Format had the mirror-image problem: any mismatch errored, including set-vs-unset, so the allOf decorator idiom over a NullableUuid: allOf: - $ref: "#/components/schemas/Uuid" # type: string, format: uuid - description: decorated # no format -> "can not merge incompatible formats" FixBoth 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
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
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 <[email protected]>
Contributor
Reviews (1): Last reviewed commit: "Propagate one-sided type and format in a..." | Re-trigger Greptile All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
This was referenced
mromaszewicz
pushed a commit
that referenced
this pull request
* Cover remaining OpenAPI 3.1 union positions in the conformance suites The review of #2522 asked for the untested union positions to be committed. Three surfaces had no conformance coverage: - array items: a named array component whose items are a union lowers to a []any alias and round-trips mixed member values - a union as a oneOf branch: the outer schema keeps the standard union machinery with the branch accessor typed any, whose As... conversion can never fail, so branch discrimination falls to the caller - response headers: ResponseHeaderDefinition.SchemaTypes() feeds the Types list the generated ClientWithResponses passes when binding declared response headers, previously exercised by no test The allOf position is already pinned by the spec added in #2526 (both member orderings), so it is deliberately not duplicated here. * Tighten comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
bug
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. MergeSchemas silently drops a member's type when an earlier allOf member has none (order-dependent output)Uh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |