Skip to content

fix(deps): update module github.com/oapi-codegen/oapi-codegen/v2 to v2.9.0 - #975

Merged
renovate[bot] merged 1 commit into
mainfrom
renovate/go-dependencies-(non-major)
Nov 21, 2026
Merged

renovate[bot] merged 1 commit into
mainfrom
renovate/go-dependencies-(non-major)

Conversation

@renovate

@renovate renovate Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
github.com/oapi-codegen/oapi-codegen/v2 v2.8.2 → v2.9.0 age confidence

Release Notes

oapi-codegen/oapi-codegen (github.com/oapi-codegen/oapi-codegen/v2)

v2.9.0: : OpenAPI 3.2 methods, smarter schema merging, more naming control

Compare Source

This is another large release. Most of the work went into three areas: a rewrite of how allOf, anyOf and oneOf become Go types (available as an option for now), more configuration for things we used to hard-code (names, struct tags, content types, JSON encoding), and a long list of bug fixes, many of them from first-time contributors. Thank you all.

The security fixes from v2.8.1 and v2.8.2 are included here as well. Those two releases were made from a separate branch, so if you're coming from v2.8.0, you get them now.

As always, the full automatically-generated changelog is at the bottom. The sections below cover what you should read before upgrading.

Before you upgrade

  • Go 1.26 is now required, both to build oapi-codegen and to build the code it generates. Go 1.27 is out, so 1.26 is the oldest supported Go release.
  • Use generated code with runtime v1.9.1 or newer. Generated code now calls JSON functions that were added in github.com/oapi-codegen/runtime v1.9.0, so it won't compile against an older runtime. v1.9.1 is needed for the form body fix described below.
  • Regenerate before you upgrade the runtime, not after. Runtime v1.9.0 removed the strictmiddleware packages. Code generated by oapi-codegen v2.6.0 or earlier still imports them, so regenerate with this release first, then update the runtime.
  • Read the breaking changes section. A few defaults changed on purpose, and the runtime changes how it encodes spaces in query parameters.

🎉 Major features

A new way of merging allOf, anyOf and oneOf, as an option (#​2563, #​2581, and many in between)

Turning schema composition into Go types has been our largest source of bugs for years. Fixing those bugs properly often changes the generated code, which we can't do to people whose specs already work. So we now have versions of the merging behavior, and you choose one:

compatibility:
  schema-merging-behavior: v3
  • v1 is the original behavior, which embeds the types of allOf members in a struct. It's what old-merge-schemas: true did; that option still works, and prints a deprecation warning.
  • v2 is what you have today, and it's still the default in this release.
  • v3 is new. It merges allOf members according to what allOf actually means, reports conflicting members as errors instead of quietly picking one, and generates union types that follow the spec more closely. For example, a oneOf that only adds constraints no longer produces a union, and an allOf that only adds a description to a $ref is simply that $ref's type.

v1 and v2 keep receiving bug fixes, but nothing that would break code that already works with them. The differences between the versions, with the code each one generates, are described in docs/schema-merging.md, including what to check when moving from v2 to v3.

Please try v3 and tell us what breaks. It becomes the default in the next release (see the end of these notes).

Dozens of allOf/anyOf/oneOf fixes, backed by a test matrix (#​2562)

Alongside the versioning work, we built a test matrix that puts every schema shape we know of in every position where we generate code (a component, a property, array items, request and response bodies, and so on), sends it through a generated client and strict server, and checks that it comes back unchanged. This found a lot of bugs, all fixed in this release:

  • Specs that failed to generate: an allOf where any member had a default, or added only readOnly/writeOnly; OpenAPI 3.1 type: [object, "null"] members; a schema with both anyOf and oneOf.
  • Generated code that didn't compile: reusable responses with inline schemas, and unions with a non-string discriminator.
  • Data that was lost or changed on the wire: non-string discriminator values, union properties that overwrote a variant's values, reusable responses whose body is an array or map, and inline request bodies with additionalProperties.
  • oneOf/anyOf parameters can now be built by callers and bound by servers.

This closes some of our oldest open issues, including #​839, #​1147, #​1379 and #​1619.

More control over generated names (#​2683)

Three new opt-in settings under output-options.naming answer several long-standing requests. Each one changes a single, narrow behavior, and nothing changes unless you set it:

output-options:
  naming:
    enum-values:
      keep-underscores: true
    properties:
      leading-underscore: drop
    explicit-names: verbatim
Setting Input Default With the setting
enum-values.keep-underscores enum value SOME_ENUM_NAME SOMEENUMNAME SOME_ENUM_NAME
properties.leading-underscore: drop property _id UnderscoreId Id
explicit-names: verbatim x-go-name: HARD_CODED_ID HARDCODEDID HARD_CODED_ID

With explicit-names: verbatim, a name you wrote by hand in x-go-name or x-enum-varnames is used exactly as written.

Configurable struct tags (#​2448)

Struct tags used to be hard-coded. The new output-options.struct-tags setting lets you change the built-in json and form tags, or add your own (yaml, db, validate, and so on). Each tag is a small Go template:

output-options:
  struct-tags:
    tags:
      - name: db
        template: '{{.FieldName}}'

Without the setting, the generated tags are exactly what they were. The older yaml-tags flag still works; a yaml entry here takes precedence over it.

Configurable content type names (#​2449)

The new output-options.content-types setting maps media types to the short name used in generated type names (the JSON in FindPetsJSONRequestBody). This is most useful for vendor media types: application/vnd.mycompany.v1+json can now produce FindPetsV1RequestBody, and gets models generated for it, instead of a name derived from the media type.

OpenAPI 3.2 QUERY and custom HTTP methods (#​2645)

OpenAPI 3.2 adds a query operation (the HTTP QUERY method) and an additionalOperations map for any other HTTP method. Both are now supported on every server and in the client.

[!IMPORTANT]
chi and Fiber only accept HTTP methods they have been told about. The generated code does not do that setup for you, because it's process-wide and one process often hosts several generated packages. If your spec uses QUERY or a custom method with chi or Fiber, add the one-time registration to your main() as described in the README and in docs/chi-server.md, docs/fiber-server.md and docs/fiber-v3-server.md.

One JSON codec for your whole program (#​2665)

Generated models, clients and servers now encode and decode JSON through the runtime instead of calling encoding/json directly. The default is still encoding/json, so nothing changes unless you ask. To use a different JSON library, call this once in your main package:

runtime.SetJSONCodec(myCodec)

This is also our intended path to encoding/json/v2. Thanks to @​CRaLFa for the implementation. A few places are not covered yet: request body binding and ctx.JSON in the Echo, Gin, Fiber and Iris strict servers still use the framework's own JSON handling.

Overlays no longer depend on the Speakeasy library (#​2643)

Our overlay support came from a library whose dependencies broke under go get -u (#​2502). We've replaced it with a small implementation of our own, which removes that whole dependency chain from the module. Overlay targets are now written in standard JSONPath (RFC 9535); see the breaking changes below if you use overlays.

More OpenAPI 3.1 support
  • Enums written as a oneOf of const values now become Go enums even when the outer schema has no type, which is the common way to write them (#​2520, thanks @​sorochinssky).
  • Multi-type schemas such as type: [string, integer] used to fail generation. They now map to any (#​2522, thanks @​bendrucker).
  • The singular example keyword is read under 3.1 (#​2523, thanks @​bendrucker).
The rest of the notables
  • Strict middleware can be shared between packages (#​2660): StrictHandlerFunc and StrictMiddlewareFunc are now type aliases, so one middleware works with every generated package for the same framework.
  • Form request bodies send arrays as repeated keys (#​2677): a client sending an application/x-www-form-urlencoded body now writes an exploded array as topic=a&topic=b when the spec says so, instead of always topic[0]=a&topic[1]=b.
  • Property names that differ only by separator no longer collide (#​2550, thanks @​rifkir23): host-fqdn and host_fqdn in one object become HostFqdn and HostFqdn2 instead of a compile error.
  • Enum values are no longer dropped when two of them map to the same Go name (#​2669, #​2678, thanks @​56steve and @​wozhenbang2004).
  • Deeply recursive schemas no longer overflow the stack (#​2543, thanks @​tobio).
  • Faster path building in generated clients (#​2046, thanks @​sterligov).
  • hasPrefix and hasSuffix are available in custom templates (#​2659, thanks @​yakovlef).
  • Generated code uses any instead of interface{} (#​2438). The two are the same type, so this only shows up in your diffs.

☢️ Breaking changes

We try hard to avoid breaking changes, and when we can't, to make them narrow or configurable. These are the changes we made on purpose in this release.

Go 1.26 and runtime v1.9.0 are required (#​2647, #​2665)

Building oapi-codegen needs Go 1.26. Generated code now needs it too, because it requires runtime v1.9.0 or newer, and that runtime requires Go 1.26.

Remote $refs are refused by default (#​2622)

v2.8.1 added the allow-remote-refs-from option and said the default would change in the next minor release. It has. A spec that references a document over http(s) now fails to load unless you list that document:

allow-remote-refs-from:
  - https://raw.githubusercontent.com/example/specs/main/common.yaml

Set it to ["*"] to get the old behavior back. References to local files are not affected. Better still, download the specs you depend on and commit them next to your own, so your build doesn't depend on a remote host.

Overlay targets use standard JSONPath (#​2643)

Overlay target expressions are now read as RFC 9535 JSONPath. The previous library used its own dialect, which differed in a few ways, mostly in how filters work and in which names are allowed after a dot. Simple targets work unchanged. If one of yours doesn't, the error message suggests the standard form. To keep reading a whole overlay in the old dialect:

compatibility:
  overlays-use-yaml-jsonpath: true

Two smaller differences: an update that targets a list now appends to it, as the Overlay specification says, and remove on the document root is an error.

Nullable fields no longer get omitempty (#​2505)

This undoes a regression from v2.6.0. Since that release, nullable fields were tagged omitempty, which meant a required, nullable field could disappear from the JSON entirely, and an optional one could never be sent as an explicit null. We've gone back to the behavior from before v2.6.0: nullable fields are always written, as null when unset.

If you came to rely on the v2.6.0 behavior, add x-omitempty: true to the affected properties, or use the nullable-type output option.

StrictHandlerFunc and StrictMiddlewareFunc are type aliases (#​2660)

This is what makes strict middleware shareable between packages. It only affects code that depended on these being distinct named types, for example by declaring methods on them. Such code needs to use the underlying function type instead.

Template files were renamed and merged (#​2486)

The server templates for the different routers had drifted apart over the years, and we've merged them into shared templates with small per-router pieces. Generated code is essentially unchanged, but if you override templates with output-options.user-templates, some of the names you override no longer exist. You'll need to move your overrides to the new template names.

Some allOf/anyOf/oneOf output changed (#​2562)

The fixes above change generated code for a few shapes that used to generate something wrong:

  • An allOf over an array keeps its item type: []X instead of []any.
  • A oneOf/anyOf next to an allOf is merged into the type instead of being dropped.
  • A default: response that refers to a reusable response uses that response's model as its body, instead of an anonymous struct.
  • Inline oneOf/anyOf parameters get a named type, <Operation>Params<Name>, instead of an anonymous struct.
Smaller behavior changes
  • Strict server response headers are formatted according to the spec (#​2513). A format: date-time header used to be written in Go's default time format, which our own generated client couldn't read. It's now RFC 3339.
  • The net/http server rejects paths it can't route (#​2492, thanks @​Solaris-star). A path such as /resources/{resourceId}:apply used to generate code that panicked at startup. It's now an error at generation time.
  • Specs with invalid strings are rejected (#​2625, #​2648). As in v2.8.1 and v2.8.2, a spec whose names would have injected Go code into the output now fails with an error pointing at the offending value. Valid specs are unaffected.
In the runtime: spaces in query parameters are sent as %20 (runtime#190)

This change is in github.com/oapi-codegen/runtime v1.10.0, not in the generator, but it affects every generated client, so it bears repeating here.

Generated clients used to encode a space in a query parameter as +. That encoding belongs to form bodies. For query parameters, OpenAPI's default style encodes a space as %20, and that's now what the runtime does. Servers that accept + also accept %20, so most people won't notice, and clients talking to strict servers that rejected + will start working. If you need the old encoding, restore it in your program:

func init() {
    runtime.DefaultQueryEncoder = runtime.NetURLQueryEncoder{}
}

Paths and form request bodies are not affected.

🔮 Upcoming changes in the next release

Two things are planned for v2.10.0, and we're telling you now so that you can prepare.

schema-merging-behavior: v3 becomes the default

v3 is an option in this release so that it can be tested on real specs. In the next release it becomes the default. v2 and v1 will remain available as settings, so nobody is forced to move.

What you can do now:

  • Try schema-merging-behavior: v3 and look at the diff in your generated code. docs/schema-merging.md explains every difference.
  • If something looks wrong, please open an issue while there's still time to fix it.
  • If you'd rather not move yet, set schema-merging-behavior: v2 explicitly, and the next release won't change anything for you.
pkg/codegen will shrink to Generate and what's needed to call it

pkg/codegen exports a great deal that was never meant to be a public API: internal data structures, template helpers, and functions that only the generator itself calls. Every one of them limits what we can change without breaking somebody.

In the next release, pkg/codegen will contain only the Generate function and the symbols needed to call it, such as the configuration types. Everything else will move to an internal package.

If you only run the oapi-codegen command, this doesn't affect you. If you import pkg/codegen and use anything other than Generate and its configuration, please open an issue and tell us what you use and why, so we can consider keeping it public.


🎉 Notable changes

🚀 New features and improvements

🐛 Bug fixes

📝 Documentation updates

👻 Maintenance

✍ Other changes

📦 Dependency updates

53 changes

[!IMPORTANT]
✂ PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the deps label Nov 21, 2026
@renovate
renovate Bot enabled auto-merge (squash) November 21, 2026 22:23
@renovate

renovate Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

ℹ️ Artifact update notice

File name: server/go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 6 additional dependencies were updated

Details:

Package Change
github.com/getkin/kin-openapi v0.149.0 -> v0.153.0
github.com/go-openapi/jsonpointer v1.0.0 -> v1.0.2
github.com/oasdiff/yaml v0.1.1 -> v0.1.3
github.com/oasdiff/yaml3 v0.0.14 -> v0.0.16
go.yaml.in/yaml/v4 v4.0.0-rc.2 -> v4.0.0
golang.org/x/tools v0.52.0 -> v0.53.0

@renovate
renovate Bot force-pushed the renovate/go-dependencies-(non-major) branch from f60d412 to a67349e Compare November 21, 2026 22:43
@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.89%. Comparing base (c4a8dca) to head (a67349e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #975      +/-   ##
==========================================
+ Coverage   90.87%   90.89%   +0.01%     
==========================================
  Files        1405     1405              
  Lines      145273   145273              
==========================================
+ Hits       132023   132049      +26     
+ Misses      13242    13216      -26     
  Partials        8        8              

see 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@renovate
renovate Bot merged commit 1121e2e into main Nov 21, 2026
38 checks passed
@renovate
renovate Bot deleted the renovate/go-dependencies-(non-major) branch November 21, 2026 23:08
fclairamb added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.53.0](v0.52.0...v0.53.0)
(2026-11-22)


### Features

* **auth:** OIDC-only mode with IdP group admin roles
([#966](#966))
([1b51f89](1b51f89))
* **service:** install writes config.env, unit loads it via
EnvironmentFile
([#948](#948))
([e4b7fc4](e4b7fc4))


### Bug Fixes

* **aggregation:** drain the raw backlog in one run and log lag
([#978](#978))
([26b93cd](26b93cd))
* **deps:** update github.com/dop251/goja digest to 79d6ad3
([#972](#972))
([02c6821](02c6821))
* **deps:** update go dependencies (non-major)
([#955](#955))
([7dfbcd6](7dfbcd6))
* **deps:** update go dependencies (non-major)
([#968](#968))
([6c09bae](6c09bae))
* **deps:** update go dependencies (non-major)
([#979](#979))
([ee088b6](ee088b6))
* **deps:** update module github.com/oapi-codegen/oapi-codegen/v2 to
v2.9.0 ([#975](#975))
([1121e2e](1121e2e))
* **deps:** update module go.mongodb.org/mongo-driver/v2 to v2.10.1
([#950](#950))
([9e684c4](9e684c4))
* email validation, OAuth error display, translator crash guard, clone
slugs, watchdog pauses
([#959](#959))
([a20f951](a20f951))
* log OAuth code-exchange failures, show a refused sign-in on the
invitation page
([#974](#974))
([c4a8dca](c4a8dca))
* retry SMTP 4xx, 503 on agent auth DB errors, scope checkGroupUid to
the org ([#973](#973))
([88179aa](88179aa))
* **security:** block WebRTC around the browser egress proxy, survive an
invalid status page ?lang=
([#957](#957))
([79bdc82](79bdc82))
* **security:** keep OIDC-group admin grants revocable, mask resolved
channel references, contain browser popups
([#976](#976))
([6e0f09e](6e0f09e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants