{"repo":"contiamo/openapi-generator-go","free":true,"listed":false,"github":"https://github.com/contiamo/openapi-generator-go","clone":"git clone https://github.com/contiamo/openapi-generator-go.git","description":"An opinionated OpenAPI v3 code generator for Go. Use this to generate API models and router scaffolding.","language":"Go","stars":113,"topics":["openapi-spec","openapi-generator","platform","golang","code-generator","openapi3","openapi"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"openapi-generator-go ==================== Generate go code from an openapi spec! Why The platform team at Contiamo has a schema first development flow. This means we write and review the OpenAPI spec before we write the implementation. To make this easier we started using (or tried to use) various OpenAPI code generators to reduce busy work and ensure precise consistent implementations. Unfortunately, we never really enjoyed the output from these generators and have created our own generator that matches our preferred style and conventions. What The generator consists of two parts 1. generator for the HTTP server mux using go-chi, and 2. a model generator for the request and response objects. The router generator We chose go-chi because it is fast, supports the standard library Handler interface, and is easy to add middlewares using r.Use . The generator will create a method NewRouter and handler interfaces that you must then implement and pass to NewRouter . It is important to note that it does not generate any handler logic, just the required interfaces. Handlers can be grouped into specific interfaces by adding x-handler-group: to your schema. This is one of the only schema extensions we have added to improve our code generation. The handler interface will be called NameHandler and will have a method matching the operationId from the spec. For example, each of our projects will implement a project specific NewRouter that does the handler configuration and initialization of","default_branch":null,"files":null,"tree":[],"storefront":"/r/contiamo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/contiamo/openapi-generator-go/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}