#development #github #golang #reading-list

🔗 Generate Go client and server from OpenAPI 3 specs

This package contains a set of utilities for generating Go boilerplate code for services based on OpenAPI 3.0 API definitions. When working with services, it's important to have an API contract which servers and clients both implement to minimize the chances of incompatibilities. It's tedious to generate Go models which precisely correspond to OpenAPI specifications, so let our code generator do that work for you, so that you can focus on implementing the business logic for your service.

We have chosen to focus on Echo as our default HTTP routing engine, due to its speed and simplicity for the generated stubs. Chi, Gin, gorilla/mux, Fiber, and Iris have also been added by contributors as additional routers. We chose Echo because the Context object is a mockable interface, and it allows for some advanced testing.

This package tries to be too simple rather than too generic, so we've made some design decisions in favor of simplicity, knowing that we can't generate strongly typed Go code for all possible OpenAPI Schemas. If there is a way to accomplish something via utility code or reflection, it's probably a better approach than code generation, which is fragile due to the very dynamic nature of OpenAPI and the very static nature of Go.

continue reading on github.com

⚠️ This post links to an external website. ⚠️