Skip to content

Commit 99b941f

Browse files
jinuthankachanmromaszewiczclaude
authored
feat: add support for echo v5 (#89)
* feat: add support for echo v5 * fix: move echo v5 strict types to own module as peer directory Move strictmiddleware/echo/v5/ to strictmiddleware/echo-v5/ with its own go.mod requiring Go 1.25, so the root module stays at Go 1.20. This avoids forcing all runtime users to upgrade to Go 1.25 just because echo v5 support was added. The echo-v5 package is a separate Go module with only the echo v5 dependency. Also changes package name from `v5` to `echo` to follow Go convention (matching how github.com/labstack/echo/v5 uses `package echo`). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore/update CI for nested modules The echo-v5 strict middleware requires Go 1.25+, which is ahead of the rest of the runtime module (Go 1.20). To support this as a separate child module, the CI and build tooling needed to become multi-module aware. - Replace four separate workflow files (ci.yml, lint.yml, tidy.yml, generate.yml) with a single ci.yml that calls the shared reusable workflow from oapi-codegen/actions v0.5.0 - Update the root Makefile to iterate child modules via git ls-files '**/*go.mod', matching the pattern used by oapi-codegen - Bump golangci-lint from v1.55.2 to v2.10.1 and update flags for v2 - Add tidy-ci target for the reusable workflow - Add strictmiddleware/echo-v5/Makefile with a Go version guard that skips gracefully when running on Go < 1.25 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Marcin Romaszewicz <marcinr@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4b9383 commit 99b941f

File tree

9 files changed

+91
-115
lines changed

9 files changed

+91
-115
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1-
name: Build project
2-
on: [ push, pull_request ]
1+
name: CI
2+
on:
3+
push: {}
4+
pull_request: {}
5+
workflow_dispatch: {}
6+
permissions:
7+
contents: read
38
jobs:
49
build:
5-
name: Build
6-
runs-on: ubuntu-latest
7-
strategy:
8-
fail-fast: false
9-
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10-
matrix:
11-
version:
12-
- "1.20"
13-
- "1.21"
14-
- "1.22"
15-
steps:
16-
- name: Check out source code
17-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18-
19-
- name: Set up Go
20-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
21-
with:
22-
go-version: ${{ matrix.version }}
23-
24-
- name: Test
25-
run: make test
10+
uses: oapi-codegen/actions/.github/workflows/ci.yml@75566d848d25021f137594c947f26171094fb511 # v0.5.0
11+
with:
12+
lint_versions: '["1.25"]'

.github/workflows/generate.yml

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

.github/workflows/lint.yml

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

.github/workflows/tidy.yml

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

Makefile

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
GOBASE=$(shell pwd)
22
GOBIN=$(GOBASE)/bin
33

4-
help:
5-
@echo "This is a helper makefile for oapi-codegen"
6-
@echo "Targets:"
7-
@echo " generate: regenerate all generated files"
8-
@echo " test: run all tests"
9-
@echo " gin_example generate gin example server code"
10-
@echo " tidy tidy go mod"
11-
124
$(GOBIN)/golangci-lint:
13-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.55.2
5+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.10.1
146

157
.PHONY: tools
168
tools: $(GOBIN)/golangci-lint
179

1810
lint: tools
11+
# run the root module explicitly, to prevent recursive calls by re-invoking `make ...` top-level
1912
$(GOBIN)/golangci-lint run ./...
13+
# then, for all child modules, use a module-managed `Makefile`
14+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && env GOBIN=$(GOBIN) make lint'
2015

2116
lint-ci: tools
22-
$(GOBIN)/golangci-lint run ./... --out-format=github-actions --timeout=5m
17+
# for the root module, explicitly run the step, to prevent recursive calls
18+
$(GOBIN)/golangci-lint run ./... --output.text.path=stdout --timeout=5m
19+
# then, for all child modules, use a module-managed `Makefile`
20+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && env GOBIN=$(GOBIN) make lint-ci'
2321

2422
generate:
23+
# for the root module, explicitly run the step, to prevent recursive calls
2524
go generate ./...
25+
# then, for all child modules, use a module-managed `Makefile`
26+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make generate'
2627

2728
test:
29+
# for the root module, explicitly run the step, to prevent recursive calls
2830
go test -cover ./...
31+
# then, for all child modules, use a module-managed `Makefile`
32+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make test'
2933

3034
tidy:
31-
@echo "tidy..."
35+
# for the root module, explicitly run the step, to prevent recursive calls
3236
go mod tidy
37+
# then, for all child modules, use a module-managed `Makefile`
38+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make tidy'
39+
40+
tidy-ci:
41+
# for the root module, explicitly run the step, to prevent recursive calls
42+
tidied -verbose
43+
# then, for all child modules, use a module-managed `Makefile`
44+
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make tidy-ci'

strictmiddleware/echo-v5/Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
MINIMUM_GO_MINOR := 25
2+
CURRENT_GO_MINOR := $(shell go version | awk '{split($$3,a,"."); print a[2]+0}')
3+
GO_VERSION_OK := $(shell [ $(CURRENT_GO_MINOR) -ge $(MINIMUM_GO_MINOR) ] && echo yes || echo no)
4+
5+
ifeq ($(GO_VERSION_OK),yes)
6+
7+
lint:
8+
$(GOBIN)/golangci-lint run ./...
9+
10+
lint-ci:
11+
$(GOBIN)/golangci-lint run ./... --output.text.path=stdout --timeout=5m
12+
13+
generate:
14+
go generate ./...
15+
16+
test:
17+
go test -cover ./...
18+
19+
tidy:
20+
go mod tidy
21+
22+
tidy-ci:
23+
tidied -verbose
24+
25+
else
26+
27+
SKIP_MSG := @echo "Skipping echo-v5: requires Go 1.$(MINIMUM_GO_MINOR)+ (have $$(go version | awk '{print $$3}'))"
28+
29+
lint lint-ci generate test tidy tidy-ci:
30+
$(SKIP_MSG)
31+
32+
endif

strictmiddleware/echo-v5/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/oapi-codegen/runtime/strictmiddleware/echo-v5
2+
3+
go 1.25.0
4+
5+
require github.com/labstack/echo/v5 v5.0.4

strictmiddleware/echo-v5/go.sum

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/labstack/echo/v5 v5.0.4 h1:ll3I/O8BifjMztj9dD1vx/peZQv8cR2CTUdQK6QxGGc=
4+
github.com/labstack/echo/v5 v5.0.4/go.mod h1:SyvlSdObGjRXeQfCCXW/sybkZdOOQZBmpKF0bvALaeo=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
8+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
9+
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
10+
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
11+
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
12+
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
13+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
14+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

strictmiddleware/echo-v5/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package echo
2+
3+
import "github.com/labstack/echo/v5"
4+
5+
type StrictEchoHandlerFunc func(ctx *echo.Context, request interface{}) (response interface{}, err error)
6+
7+
type StrictEchoMiddlewareFunc func(f StrictEchoHandlerFunc, operationID string) StrictEchoHandlerFunc

0 commit comments

Comments
 (0)