Do you use swagger to generate backends?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • GoSwagger

    Swagger 2.0 implementation for go

  • Then define the corresponding YAML/JSON specification (again manually) either using Swagger 2.0 (with go-swagger) or OpenAPI 3 (with kin-openapi), and

  • openapi-generator

    OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

  • I had a play with this approach a couple of months ago. The goal was to come up with a workflow built around the https://openapi-generator.tech (https://github.com/OpenAPITools/openapi-generator) OpenAPI code generator which would enable a swagger/OpenAPI spec doc to be iterated upon and for changes to the spec doc to result in automated updates to generated GO server code.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • kin-openapi

    OpenAPI 3.0 (and Swagger v2) implementation for Go (parsing, converting, validation, and more)

  • Then define the corresponding YAML/JSON specification (again manually) either using Swagger 2.0 (with go-swagger) or OpenAPI 3 (with kin-openapi), and

  • oapi-codegen

    Generate Go client and server boilerplate from OpenAPI 3 specifications

  • Finally, if you need to generate clients, use the corresponding generate -like tools, go-swagger uses swagger generate, and for OpenAPI 3 you could use oapi-codegen.

  • go-user-api

    A sample Go user API

  • I ended up with https://github.com/jjssoftware/go-user-api which uses an automated github workflow and it did work.

  • swagger-petstore

    swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.

  • Not specific to Go, but included, there are two main code generators: Swagger codegen (the private company project) and OpenAPI codegen (the opensource, community driven project)

  • goa

    🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨

  • I am using https://goa.design/ for two smaller projects. It generate server backend code and OpenAPI spec. And I use this OpenAPI spec for generate dart client code.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • rest

    Web services with OpenAPI and JSON Schema done quick in Go (by swaggest)

  • I've tried go-swagger comments to instrument existing code, but wasn't quite satisfied due to magical nature and error friendliness of those comments. So I decided to implement first-class OpenAPI generation on top of self-documenting action handlers: https://github.com/swaggest/rest/blob/master/_examples/basic/main.go. Schemas are generated from request and response structures using reflection and field tags.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts