Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80261cd
feat: support for use-httprouter-in-std-http-server in compatibility-…
szarowski Jan 26, 2026
4480676
feat: use-httprouter-in-std-http-server is now in output-options and …
szarowski Jan 26, 2026
606fc7a
OpenAPI v3.1 support, experimental re-implementation using libopenapi…
mromaszewicz Feb 7, 2026
b38cd1d
fix(deps): update module github.com/go-chi/chi/v5 to v5.2.2 [security…
renovate[bot] Feb 7, 2026
527f7fb
Add output filtering (#2201)
mromaszewicz Feb 7, 2026
e3f4e6b
Rename Swagger references to OpenAPI (#2202)
mromaszewicz Feb 7, 2026
2871399
docs(sponsors): update section
jamietanna Feb 5, 2026
270c93c
Revert "Rename Swagger references to OpenAPI (#2202)"
jamietanna Feb 7, 2026
2ed5751
Revert "Add output filtering (#2201)"
jamietanna Feb 7, 2026
51c6886
Revert "fix(deps): update module github.com/go-chi/chi/v5 to v5.2.2 […
jamietanna Feb 7, 2026
2689a57
Revert "OpenAPI v3.1 support, experimental re-implementation using li…
jamietanna Feb 7, 2026
d31eddb
build: use a re-usable, single, workflow for running CI
jamietanna Feb 7, 2026
6047d18
fix(deps): update module github.com/gofiber/fiber/v2 to v2.52.11 [sec…
renovate[bot] Feb 9, 2026
6feac2d
docs(extensions): correct links to examples (#1836)
yuro241 Feb 9, 2026
0a2b6db
docs: fix link to example (#1884)
rkosegi Feb 9, 2026
cdd9989
Fixes type collision for enum values that start with _ (underscore) (…
ula Feb 9, 2026
57a9c0c
Fix broken code when response content is not exist, but response head…
ShouheiNishi Feb 9, 2026
d85ce23
chore: readme update (#2209)
mromaszewicz Feb 10, 2026
03f6688
Adopt fiber middleware template for updated GetReqHeaders() method si…
getBolted Feb 10, 2026
981272d
fixed duplicate type names (#200)
mgurevin Feb 10, 2026
8716923
Merge branch 'main' into feat/httprouter
szarowski Feb 10, 2026
cc6200f
docs(extensions): correct links to examples (#1836)
yuro241 Feb 9, 2026
541913a
docs: fix link to example (#1884)
rkosegi Feb 9, 2026
3a55e38
Merge branch 'main' into feat/httprouter
szarowski Feb 12, 2026
330461a
feat: httprouter in std-http-server is now per template and in additi…
szarowski Feb 13, 2026
34b9d4d
fix: spec nil check in findSchemaNameByRefPath in utils
szarowski Feb 13, 2026
ef6af0c
fix: setup for initialismsMap in TestToCamelCaseWithInitialisms
szarowski Feb 13, 2026
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
5 changes: 5 additions & 0 deletions configuration-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@
"type": "boolean",
"description": "When set to true, automatically renames types that collide across different OpenAPI component sections (schemas, parameters, requestBodies, responses, headers) by appending a suffix based on the component section (e.g., 'Parameter', 'Response', 'RequestBody'). Without this, the codegen will error on duplicate type names, requiring manual resolution via x-go-name.",
"default": false
},
"use-httprouter-in-std-http-server": {
"type": "boolean",
"description": "When generating `std-http-server` code, use `httprouter` for routing instead of the default `http.ServeMux`. This allows for better performance and more advanced routing capabilities.",
"default": false
}
}
},
Expand Down
36 changes: 36 additions & 0 deletions examples/minimal-server/stdhttp-go-tool-httprouter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SHELL:=/bin/bash

YELLOW := \e[0;33m
RESET := \e[0;0m

GOVER := $(shell go env GOVERSION)
GOMINOR := $(shell bash -c "cut -f1 -d' ' <<< \"$(GOVER)\" | cut -f2 -d.")

define execute-if-go-124
@{ \
if [[ 24 -le $(GOMINOR) ]]; then \
$1; \
else \
echo -e "$(YELLOW)Skipping task as you're running Go v1.$(GOMINOR).x which is < Go 1.24, which this module requires$(RESET)"; \
fi \
}
endef

lint:
$(call execute-if-go-124,$(GOBIN)/golangci-lint run ./...)

lint-ci:

$(call execute-if-go-124,$(GOBIN)/golangci-lint run ./... --output.text.path=stdout --timeout=5m)

generate:
$(call execute-if-go-124,go generate ./...)

test:
$(call execute-if-go-124,go test -cover ./...)

tidy:
$(call execute-if-go-124,go mod tidy)

tidy-ci:
$(call execute-if-go-124,tidied -verbose)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=../../../../configuration-schema.json
package: api
output: ping.gen.go
generate:
models: true
std-http-server: true
additional-imports:
- package: github.com/julienschmidt/httprouter
alias: httprouter
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package api

//go:generate go tool oapi-codegen -config cfg.yaml ../../api.yaml
25 changes: 25 additions & 0 deletions examples/minimal-server/stdhttp-go-tool-httprouter/api/impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package api

import (
"encoding/json"
"net/http"
)

// ensure that we've conformed to the `ServerInterface` with a compile-time check
var _ ServerInterface = (*Server)(nil)

type Server struct{}

func NewServer() Server {
return Server{}
}

// (GET /ping)
func (Server) GetPing(w http.ResponseWriter, r *http.Request) {
resp := Pong{
Ping: "pong",
}

w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(resp)
}
173 changes: 173 additions & 0 deletions examples/minimal-server/stdhttp-go-tool-httprouter/api/ping.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions examples/minimal-server/stdhttp-go-tool-httprouter/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module github.com/oapi-codegen/oapi-codegen/v2/examples/minimal-server/stdhttp-go-tool-httprouter

go 1.24

replace github.com/oapi-codegen/oapi-codegen/v2 => ../../../

tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen

require github.com/julienschmidt/httprouter v1.3.0

require (
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/getkin/kin-openapi v0.133.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/oapi-codegen/oapi-codegen/v2 v2.0.0-00010101000000-000000000000 // indirect
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/speakeasy-api/jsonpath v0.6.0 // indirect
github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/woodsbury/decimal128 v1.3.0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading