oapi-codegen with Gin and Echo

Thu, May 25, 2023 One-minute read

oapi-codegen with Gin and Echo

Don’t work with anything other than the default base URL.

For example,

I want everything served at /api to be routed through the oapi-codegen generated ServerInteface. Anything else is not routed via oapi-codegen routes.

Doing this allows me to have an API backend and run a traditional web application.

In go-chi this is achievable and works really well.

In both gin and echo this is not possible. There are issues for echo in oapi-codegen’s github repo. The gin examples and google searches proved fruitless.

Don’t waste time on this. Sure I have to write a lot more to get chi working but it is pretty simple and highly extensible.

Tags:

#echo #gin #oapi-codegen #golang