Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit 6fc8d2f

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 3650846 + 5bde24d commit 6fc8d2f

9 files changed

Lines changed: 35 additions & 196 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: Build project
2-
on: [ push, pull_request ]
3-
1+
name: CI
2+
on:
3+
push: {}
4+
pull_request: {}
5+
workflow_dispatch: {}
46
permissions:
57
contents: read
6-
78
jobs:
89
build:
9-
name: Build
10+
uses: oapi-codegen/actions/.github/workflows/ci.yml@b9f2c274c1c631e648931dbbcc1942c2b2027837 # v0.4.0
11+
12+
build-binaries:
1013
runs-on: ubuntu-latest
1114
strategy:
12-
fail-fast: false
13-
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
15+
fail-fast: true
1416
matrix:
1517
version:
16-
- "1.22"
17-
- "1.23"
18-
- "1.24"
19-
- "1.25"
18+
- "stable"
19+
- "oldstable"
2020
steps:
2121
- name: Check out source code
2222
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -26,25 +26,8 @@ jobs:
2626
with:
2727
go-version: ${{ matrix.version }}
2828

29-
- name: Test
30-
run: make test
29+
- name: Build
30+
run: go build ./cmd/oapi-codegen
3131
env:
3232
# A combination of our GitHub Actions setup, with the Go toolchain, leads to inconsistencies in calling `go env`, in particular with Go 1.21, where having (the default) `GOTOOLCHAIN=auto` results in build failures
3333
GOTOOLCHAIN: local
34-
35-
- name: Build
36-
run: go build ./cmd/oapi-codegen
37-
38-
results:
39-
if: ${{ always() }}
40-
runs-on: ubuntu-latest
41-
name: Check build results
42-
needs: [build]
43-
steps:
44-
- run: |
45-
result="${{ needs.build.result }}"
46-
if [[ $result == "success" || $result == "skipped" ]]; then
47-
exit 0
48-
else
49-
exit 1
50-
fi

.github/workflows/generate.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/tidy.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ We can see that this provides the best means to focus on the implementation of t
402402
- Support multiple OpenAPI files by having a package-per-OpenAPI file
403403
- Support of OpenAPI 3.0
404404
- OpenAPI 3.1 support is [awaiting upstream support](https://github.com/oapi-codegen/oapi-codegen/issues/373)
405+
However, we do have an experimental version using a different OpenAPI parser which does support 3.1 and 3.2, which
406+
you can play around with in our [experimental repo](https://github.com/oapi-codegen/oapi-codegen-exp/tree/main/experimental)
405407
- Note that this does not include OpenAPI 2.0 (aka Swagger)
406408
- Extract parameters from requests, to reduce work required by your implementation
407409
- Implicit `additionalProperties` are ignored by default ([more details](#additional-properties-additionalproperties))

examples/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ require (
88
github.com/getkin/kin-openapi v0.133.0
99
github.com/gin-gonic/gin v1.10.0
1010
github.com/go-chi/chi/v5 v5.0.10
11-
github.com/gofiber/fiber/v2 v2.52.4
12-
github.com/google/uuid v1.5.0
11+
github.com/gofiber/fiber/v2 v2.52.11
12+
github.com/google/uuid v1.6.0
1313
github.com/gorilla/mux v1.8.1
1414
github.com/kataras/iris/v12 v12.2.6-0.20230908161203-24ba4e8933b9
1515
github.com/labstack/echo/v4 v4.12.0
@@ -32,7 +32,7 @@ require (
3232
github.com/CloudyKit/jet/v6 v6.2.0 // indirect
3333
github.com/Joker/jade v1.1.3 // indirect
3434
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect
35-
github.com/andybalholm/brotli v1.0.5 // indirect
35+
github.com/andybalholm/brotli v1.1.0 // indirect
3636
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
3737
github.com/aymerick/douceur v0.2.0 // indirect
3838
github.com/bytedance/sonic v1.11.6 // indirect
@@ -64,7 +64,7 @@ require (
6464
github.com/kataras/pio v0.0.12 // indirect
6565
github.com/kataras/sitemap v0.0.6 // indirect
6666
github.com/kataras/tunnel v0.0.4 // indirect
67-
github.com/klauspost/compress v1.17.0 // indirect
67+
github.com/klauspost/compress v1.17.9 // indirect
6868
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
6969
github.com/labstack/gommon v0.4.2 // indirect
7070
github.com/leodido/go-urn v1.4.0 // indirect
@@ -77,7 +77,7 @@ require (
7777
github.com/mailru/easyjson v0.7.7 // indirect
7878
github.com/mattn/go-colorable v0.1.13 // indirect
7979
github.com/mattn/go-isatty v0.0.20 // indirect
80-
github.com/mattn/go-runewidth v0.0.15 // indirect
80+
github.com/mattn/go-runewidth v0.0.16 // indirect
8181
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
8282
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8383
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -112,7 +112,7 @@ require (
112112
golang.org/x/mod v0.21.0 // indirect
113113
golang.org/x/net v0.29.0 // indirect
114114
golang.org/x/sync v0.9.0 // indirect
115-
golang.org/x/sys v0.25.0 // indirect
115+
golang.org/x/sys v0.28.0 // indirect
116116
golang.org/x/text v0.20.0 // indirect
117117
golang.org/x/time v0.5.0 // indirect
118118
golang.org/x/tools v0.25.1 // indirect

examples/go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP
1313
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM=
1414
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
1515
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
16-
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
17-
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
16+
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
17+
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
1818
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
1919
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
2020
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
@@ -79,8 +79,8 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
7979
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
8080
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
8181
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
82-
github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM=
83-
github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
82+
github.com/gofiber/fiber/v2 v2.52.11 h1:5f4yzKLcBcF8ha1GQTWB+mpblWz3Vz6nSAbTL31HkWs=
83+
github.com/gofiber/fiber/v2 v2.52.11/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
8484
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
8585
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
8686
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -106,8 +106,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
106106
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
107107
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
108108
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
109-
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
110-
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
109+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
110+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
111111
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
112112
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
113113
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
@@ -139,8 +139,8 @@ github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY
139139
github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4=
140140
github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA=
141141
github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw=
142-
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
143-
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
142+
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
143+
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
144144
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
145145
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
146146
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
@@ -180,8 +180,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
180180
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
181181
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
182182
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
183-
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
184-
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
183+
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
184+
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
185185
github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg=
186186
github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE=
187187
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
@@ -379,8 +379,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
379379
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
380380
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
381381
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
382-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
383-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
382+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
383+
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
384384
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
385385
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
386386
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=

pkg/codegen/templates/strict/strict-iris-interface.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
{{end -}}
129129
func (response {{$opid}}{{$statusCode}}Response) Visit{{$opid}}Response(ctx iris.Context) error {
130130
{{range $headers -}}
131-
ctx.Response().Header.Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}}))
131+
ctx.ResponseWriter().Header().Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}}))
132132
{{end -}}
133133
ctx.StatusCode({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}})
134134
return nil

pkg/codegen/utils_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ func TestSchemaNameToTypeName(t *testing.T) {
604604
"=3": "Equal3",
605605
"#Tag": "HashTag",
606606
".com": "DotCom",
607+
"_1": "Underscore1",
607608
">=": "GreaterThanEqual",
608609
"<=": "LessThanEqual",
609610
"<": "LessThan",

0 commit comments

Comments
 (0)