Commit 717f462
feat: Support echo/v5 (#2188)
* feat: server code generation for echo/v5
* feat/echov5-codegen (#6)
* server code generation for echo/v5
* does not include:
- strict-server for echo/v5
- middlewares for echo/v5
* fix: rename PathParam to Param for echo/v5
* fix: missing parts for strict server (#9)
* fix: add the missing strict server generation
* Clean up router imports
Instead of hardcoding each router's framework and strict middleware
imports directly in imports.tmpl with per-router conditional blocks,
compute them in Go code via GenerateOptions.RouterImports() and pass
them to the template as RouterImports. The template now uses a single
range loop over .RouterImports, making it straightforward to add new
routers without touching the template.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add petstore-expanded/echo-v5 example
Echo v5 version of the petstore-expanded example, in its own Go module
(go 1.25.0) to avoid bumping the Go version of the shared examples module.
Key differences from the echo (v4) example:
- *echo.Context (pointer) instead of echo.Context (interface)
- echo.NewHTTPError(code, message) takes exactly two args
- No HTTPError.Internal field
- EchoRouter returns echo.RouteInfo instead of *echo.Route
- log.Fatal(e.Start(...)) instead of e.Logger.Fatal(...)
Includes an inline OpenAPI request validation middleware (middleware/)
adapted from echo-middleware for echo v5, since no published echo-v5
middleware package exists yet.
Models and server stubs are placeholders until the codegen circular
dependency for go:generate in isolated modules is resolved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: skip echo-v5 example on Go < 1.25
The echo-v5 example requires Go 1.25+ (for echo/v5). When CI runs
with GOTOOLCHAIN=local on Go 1.24, the module refuses to build.
Add a Go version guard to the Makefile so all targets skip gracefully
with an informational message on older Go versions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: DanDagadita <dandagadita@gmail.com>
Co-authored-by: Marcin Romaszewicz <marcinr@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent f459fd7 commit 717f462
22 files changed
Lines changed: 1509 additions & 20 deletions
File tree
- cmd/oapi-codegen
- examples/petstore-expanded/echo-v5
- api
- models
- middleware
- tools
- pkg/codegen
- templates
- echo/v5
- strict
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
515 | 517 | | |
516 | 518 | | |
517 | 519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 204 | + | |
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| |||
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
229 | | - | |
230 | | - | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
| 302 | + | |
305 | 303 | | |
306 | 304 | | |
307 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 247 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments