GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cover remaining OpenAPI 3.1 union test positions by bendrucker · Pull Request #2530 · oapi-codegen/oapi-codegen

Conversation

@bendrucker

@bendrucker bendrucker commented Aug 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Adds conformance tests for the multi-type union positions the #2522 review found missing.

A union in array-items position lowers to a []any alias and round-trips mixed member values. A union as a oneOf branch keeps the outer schema's union machinery with an any-typed accessor, so As... never fails and branch discrimination falls to the caller. A union-typed response header exercises the Types list that ClientWithResponses passes when binding declared headers, which had no test. The allOf position is skipped because #2526 already covers both member orderings.

Test-only. Repo-wide make generate changes nothing outside the two openapi31 suites.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bendrucker
Cover remaining OpenAPI 3.1 union positions in the conformance suites
b9a8d90
The review of oapi-codegen#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 oapi-codegen#2526 (both
member orderings), so it is deliberately not duplicated here.
@bendrucker
bendrucker requested a review from a team as a code owner August 19, 2026 02:38
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR expands OpenAPI 3.1 multi-type union conformance coverage without changing generator implementation.

  • Adds array-item and oneOf-branch union fixtures and generated models.
  • Verifies union-typed response headers preserve member-order parsing through ClientWithResponses.
  • Documents the intentionally permissive behavior of an any-typed oneOf branch.

Confidence Score: 5/5

The test-only PR appears safe to merge, with no concrete correctness or generated-API failures identified.

The added specifications, generated fixtures, and tests consistently exercise the intended OpenAPI 3.1 union behavior, and the generated diffs contain no unrelated API drift.

Important Files Changed

Filename Overview
internal/test/openapi31/spec.yaml Adds representative array-item and oneOf-branch multi-type union schemas consistent with the generated fixtures.
internal/test/openapi31/openapi31_test.go Tests the intended []any lowering and explicitly pins the permissive oneOf branch-accessor behavior.
internal/test/openapi31/openapi31.gen.go Generated output contains the expected array alias and standard oneOf union machinery without unrelated drift.
internal/test/openapi31params/spec.yaml Declares an integer-or-string response header on the existing HTTP 200 response.
internal/test/openapi31params/openapi31params_test.go Exercises generated response-header parsing for both integer and string members through the real client/server path.
internal/test/openapi31params/openapi31params.gen.go Generated response parsing correctly passes the ordered schema types to the runtime styled-parameter binder.

Reviews (1): Last reviewed commit: "Cover remaining OpenAPI 3.1 union positi..." | Re-trigger Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bendrucker
Tighten comments
5bb11d5
mromaszewicz
mromaszewicz approved these changes Nov 9, 2026
View reviewed changes
@mromaszewicz
mromaszewicz merged commit e77fc90 into oapi-codegen:main Nov 9, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mromaszewicz mromaszewicz added the internal label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mromaszewicz mromaszewicz mromaszewicz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

internal

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@bendrucker @mromaszewicz
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.