馃帀 Notable changes
Modifying the input OpenAPI Specification, without needing to modify it directly
Prior to oapi-codegen v2.4.0, users wishing to override specific configuration, for instance taking advantage of extensions such as x-go-type would need to modify the OpenAPI specification they are using.
In a lot of cases, this OpenAPI specification would be produced by a different team to the consumers (or even a different company) and so asking them to make changes like this were unreasonable.
This would lead to the API consumers needing to vendor the specification from the producer (which is our recommendation anyway) and then make any number of local changes to the specification to make it generate code that looks reasonable.
However, in the case that a consumer would update their specification, they would likely end up with a number of merge conflicts.
Now, as of oapi-codegen v2.4.0, it is now possible to make changes to the input OpenAPI specification without needing to modify it directly.
This takes advantage of the OpenAPI Overlay specification, which is a stable specification.
We're very excited for y'all to be able to take advantage of this, and to be able to manipulate complex specifications you don't have control over.
Using a single package, with multiple OpenAPI spec for a given package
Since oapi-codegen v2.4.0, it is now possible to split large OpenAPI specifications into the same Go package, using the "self" mapping (denoted by a -) when using Import Mapping.
This is an improvement on the previous model, which would require splitting files across multiple packages.
This should improve the ability to use a multi-file OpenAPI specification.
Reverting a breaking change to Strict servers using text/plain
Changes in https://github.com/oapi-codegen/oapi-codegen/pull/1132 had unintended side effects, and so we have reverted this.
This will be a breaking change to anyone who had pulled in this change, since it landed in v1.13.1.
Minimum version of Go needed for oapi-codegen is now 1.21
Does what it says on the tin.
This was required for a new dependency, and given Go 1.21 is now End-of-Life, this isn't too bad a requirement, without requiring folks unnecessarily bump their minimum supported version higher.
Starting work towards the OpenSSF Best Practices badge
As a means to better understand the compliance of oapi-codegen with OpenSSF's Best Practices guide, we've started work towards the "passing" badge.
This gives us some insight into where we have gaps, and makes it known for our users, too.
PR Builds now have required status checks
Previously, PR builds did not have a required status check.
Although as maintainers we would only merge changes after the CI checks had passed, this now gives us - and you as our users - greater confidence in the stability of the project.
Previously raised PRs - before 2024-09-20 - will need to merge in the latest changes in main before these status checks will pass.
馃殌 New features and improvements
- feat: allow
import-mappingto the current package (#1774) @jamietanna @djgilcrease - feat(std-http): accept
Muxinterface instead of*http.ServeMux(#1720) @sonalys - feat: handle
<and>in property or type names (#1740) @ansoni - feat: add support for OpenAPI Overlay (#1727) @jamietanna
- feat(extension): add
x-oapi-codegen-only-honour-go-name(#1697) @jamietanna
馃悰 Bug fixes
- Revert "fix(template): fix strict-interface template to make sure text response content type uses string type (#1132)" (#1773) @jamietanna
- fix: correctly generate structs and properties for
anyOfs (#1178) @daleef-rahman - fix(cookies): wrap
cookievariables in block scope (#1687) @andremarianiello - fix(extensions): use the
x-orderfrom next to$ref, if present (#1700) @paulmach - fix(oapi-codegen): add missing newline to error when swagger spec load fails (oapi-codegen#1688) (#1690) @willbuckner
馃摑 Documentation updates
- docs: correct wording of heading (#1776) @jamietanna
- docs: remove
deepmap/oapi-codegenreferences (#1771) @jamietanna - docs(tests): add an example of using
in: cookie(#1770) @jamietanna - docs(sponsors): add Cybozu (#1768) @jamietanna
- docs: add link to OpenSSF Best Practices badge (#1761) @jamietanna
- Update CONTRIBUTING.md (#1750) @joeriddles
- docs(overlay): improve Overlay docs (#1749) @jamietanna
- Fix usage YAML example schema path in README.md (#1748) @gren236
- Update link for DevZero (#1716) @dray92
- Update speakeasy URL on oapi-codegen (#1707) @ndimares
- docs(sponsors): add Elastic (#1667) @jamietanna
- docs(sponsors): add
FUNDING.yml(#1661) @jamietanna - docs(sponsors): add Speakeasy (#1649) @jamietanna
- docs: correct module path replacements (#1657) @jamietanna
- docs: clarify module version installations (#1653) @jamietanna
馃懟 Maintenance
- build: check results of matrix jobs (#1769) @jamietanna
- build: require Go 1.21 to build (#1728) @jamietanna
- build: validate against Go 1.23 (#1724) @jamietanna
- chore: make it possible to provide detailed config validation errors (#1699) @jamietanna
- chore: remove accidental compiled binary (#1698) @jamietanna
- Avoid extra http.Request allocation (stdhttp, chi, gorilla) (#1673) @gaiaz-iusipov
- chore: correct Release Drafter branch (#1654) @jamietanna
馃摝 Dependency updates
9 changes
- chore(deps): update module github.com/golangci/golangci-lint to v1.61.0 (#1753) @renovate
- fix(deps): update module golang.org/x/text to v0.18.0 (#1640) @renovate
- chore(deps): update module github.com/golangci/golangci-lint to v1.60.3 (#1735) @renovate
- chore(deps): update module github.com/golangci/golangci-lint to v1.60.2 (#1731) @renovate
- fix(deps): update module github.com/getkin/kin-openapi to v0.127.0 (#1711) @renovate
- chore(deps): update module github.com/golangci/golangci-lint to v1.60.1 (#1725) @renovate
- fix(deps): update module github.com/getkin/kin-openapi to v0.126.0 (#1689) @renovate
- fix(deps): update module github.com/getkin/kin-openapi to v0.125.0 (#1659) @renovate
- chore(deps): update module github.com/golangci/golangci-lint to v1.59.1 (#1658) @renovate
Sponsors
We would like to thank our sponsors for their support during this release.