Skip to content

Conversation

@dependabot
Copy link

@dependabot dependabot bot commented on behalf of github Nov 3, 2025

Bumps github.com/oapi-codegen/oapi-codegen/v2 from 2.4.1 to 2.5.1.

Release notes

Sourced from github.com/oapi-codegen/oapi-codegen/v2's releases.

v2.5.0: No more optional pointers (optionally), omitzero, better control over initialisms, and so much more!

v2.5.0: No more optional pointers (optionally)!

🎉 Notable changes

Begone optional pointers! (optionally)

One of the key things oapi-codegen does is to use an "optional pointer", following idiomatic Go practices, to indicate that a field/type is optional.

This can be tuned on a per-field basis, using the x-go-type-skip-optional-pointer extension, but it can be a bit repetitive, or can be more complex when using an OpenAPI Overlay.

As of oapi-codegen v2.5.0, this can be tuned in two specific ways, via the following Output Options:

  • prefer-skip-optional-pointer: a global default that you do not want the "optional pointer" generated. Optional fields will not have an "optional pointer", and will have an omitempty JSON tag
  • prefer-skip-optional-pointer-with-omitzero: when used in conjunction with prefer-skip-optional-pointer, any optional fields are generated with an omitzero JSON tag. Requires Go 1.24+

In both cases, there is control on a per-field level to set x-go-type-skip-optional-pointer: false or x-omitzero: false to undo these to field(s).

[!NOTE] The default is not changing.

We take care to avoid breaking changes so this is, as many changes, an opt-in.

See Globally skipping the "optional pointer" for more details.

Generating omitzero JSON tags, with x-omitzero

Related to the above functionality, it is possible to define the OpenAPI extension x-omitzero on fields to generate the omitzero JSON tag, based on the (now not-so-new) Go 1.24 release.

Thanks to @​lzap for the contribution 🚀

[!NOTE] oapi-codegen does not currently validate the Go version that the module it's generating code for.

This could lead to the omitzero JSON tag being generated, but not being actually usable.

Ensure that you're using a Go 1.24+ version, and that your go directive (for source compatibility) is go 1.24 or i.e. go 1.24.1

Using OpenAPI 3.1 with oapi-codegen

There's some promising behind-the-scenes discussions with may lead to OpenAPI 3.1 support (#373) coming in the not-too-distant future 👀

In the meantime, Jamie (one of the Core Maintainers) has written a blog post about how to use oapi-codegen with OpenAPI 3.1 specs (by downgrading them to OpenAPI 3.0).

Defining your own initialisms

As a means to define your own custom initialisms, it's possible to use the additional-initialisms Output Option.

Thanks @​micaelmalta for the contribution 🚀

... (truncated)

Commits
  • 1401fbe fix(deps): update module github.com/getkin/kin-openapi to v0.133.0 (go.mod)
  • 029a739 fix(deps): update module github.com/stretchr/testify to v1.11.1 (go.mod)
  • f7a23df chore(deps): update module github.com/golangci/golangci-lint to v2.6.0 (makef...
  • 226a25f chore(renovate): correctly create branches for top-level files
  • ae106ad chore(deps): update ossf/scorecard-action action to v2.4.3 (.github/workflows)
  • 1a6d918 chore(deps): update actions/upload-artifact action to v5 (.github/workflows)
  • 67c6c89 chore(deps): update actions/setup-go action to v6 (.github/workflows)
  • 78601a5 chore(deps): update actions/labeler action to v6 (.github/workflows)
  • f6a603a chore(deps): update actions/checkout action to v5 (.github/workflows)
  • 2618db7 chore(deps): update github/codeql-action action to v4 (.github/workflows)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [github.com/oapi-codegen/oapi-codegen/v2](https://github.com/oapi-codegen/oapi-codegen) from 2.4.1 to 2.5.1.
- [Release notes](https://github.com/oapi-codegen/oapi-codegen/releases)
- [Commits](oapi-codegen/oapi-codegen@v2.4.1...v2.5.1)

---
updated-dependencies:
- dependency-name: github.com/oapi-codegen/oapi-codegen/v2
  dependency-version: 2.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file go Pull requests that update go code labels Nov 3, 2025
@openshift-ci openshift-ci bot requested a review from aliok November 3, 2025 13:44
@openshift-ci openshift-ci bot requested a review from matzew November 3, 2025 13:44
@openshift-ci
Copy link

openshift-ci bot commented Nov 3, 2025

Hi @dependabot[bot]. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link

openshift-ci bot commented Nov 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dependabot[bot]
Once this PR has been reviewed and has the lgtm label, please ask for approval from aliok. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file go Pull requests that update go code needs-ok-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants