Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
name: Build project
on: [ push, pull_request ]
name: CI
on:
push: {}
pull_request: {}
workflow_dispatch: {}
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
matrix:
version:
- "1.20"
- "1.21"
- "1.22"
steps:
- name: Check out source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Set up Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ matrix.version }}

- name: Test
run: make test
uses: oapi-codegen/actions/.github/workflows/ci.yml@75566d848d25021f137594c947f26171094fb511 # v0.5.0
with:
lint_versions: '["1.25"]'
28 changes: 0 additions & 28 deletions .github/workflows/generate.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/lint.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/tidy.yml

This file was deleted.

34 changes: 23 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin

help:
@echo "This is a helper makefile for oapi-codegen"
@echo "Targets:"
@echo " generate: regenerate all generated files"
@echo " test: run all tests"
@echo " gin_example generate gin example server code"
@echo " tidy tidy go mod"

$(GOBIN)/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.55.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.10.1

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

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

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

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

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

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

tidy-ci:
# for the root module, explicitly run the step, to prevent recursive calls
tidied -verbose
# then, for all child modules, use a module-managed `Makefile`
git ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make tidy-ci'
32 changes: 32 additions & 0 deletions strictmiddleware/echo-v5/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
MINIMUM_GO_MINOR := 25
CURRENT_GO_MINOR := $(shell go version | awk '{split($$3,a,"."); print a[2]+0}')
GO_VERSION_OK := $(shell [ $(CURRENT_GO_MINOR) -ge $(MINIMUM_GO_MINOR) ] && echo yes || echo no)

ifeq ($(GO_VERSION_OK),yes)

lint:
$(GOBIN)/golangci-lint run ./...

lint-ci:
$(GOBIN)/golangci-lint run ./... --output.text.path=stdout --timeout=5m

generate:
go generate ./...

test:
go test -cover ./...

tidy:
go mod tidy

tidy-ci:
tidied -verbose

else

SKIP_MSG := @echo "Skipping echo-v5: requires Go 1.$(MINIMUM_GO_MINOR)+ (have $$(go version | awk '{print $$3}'))"

lint lint-ci generate test tidy tidy-ci:
$(SKIP_MSG)

endif
5 changes: 5 additions & 0 deletions strictmiddleware/echo-v5/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/oapi-codegen/runtime/strictmiddleware/echo-v5

go 1.25.0

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

import "github.com/labstack/echo/v5"

type StrictEchoHandlerFunc func(ctx *echo.Context, request interface{}) (response interface{}, err error)

type StrictEchoMiddlewareFunc func(f StrictEchoHandlerFunc, operationID string) StrictEchoHandlerFunc