goa
oapi-codegen
Our great sponsors
goa | oapi-codegen | |
---|---|---|
40 | 63 | |
5,453 | 5,148 | |
0.7% | 4.4% | |
9.3 | 9.0 | |
5 days ago | 7 days ago | |
Go | Go | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
goa
-
Microservices communication
See https://goa.design/. It automates all the comms stuff, so you just write: 1) a design file showing your functions, 2) an implantation of those functions, and 3) a very generic "main.go" (basically the same for all your services) that decides "how is this exposed over gRPC or REST or other comms?". The rest of the code is generated.
-
Create Production-Ready SDKs with Goa
Perhaps the easiest way to find out how to do something (especially when using Meta) is to search the test cases when you have cloned the source code.
-
Which is the best framework to create web apps with go?
If you really need a framework, you can take a look at Echo or, for a contract-first approach, https://goa.design/
-
OpenAPI v4 Proposal
Few folks in here are (rightly) frustrated with the code generation story and broader tooling support around the OpenAPI standard. I've found a few alternative approaches quite nice to work with:
- Use a DSL to describe your service and have it spit out the OpenAPI spec as well as server stubs. In other words, I wouldn't bother writing OpenAPI directly - it's an artifact that is generated at build time. As a Go user, I quite like Goa (https://goa.design/) but there are others shared in here like TypeSpec.
- There are situations where sticking a backend-for-frontend (BFF) in front of APIs can yield great productivity boosts. For example, in the past we built a thin GraphQL proxy that calls out to a poorly structured REST API. Integrating with that was much more convenient. Most recently, I've been playing with a BFF built with tRPC (https://trpc.io/) which calls out to a REST API. It seemed to provide an even better experience if you use TypeScript on the front-end and in the BFF. It does not have a codegen step and I was really pleased with how fast I could iterate with it - granted it was a toy project.
-
Beginner-friendly API made with Go following hexagonal architecture.
One of the biggest issues I see is that you are using the same models for API as you are for the database. That wouldn’t fly in a real work system. And even though your doing simple CRUD I would introduce another layer for business logic. You should never have the Controller calling you database code directly. It never “stays” that simplistic. One of the easiest ways to deal with this is to use Goa. https://goa.design/ It takes care of generating your API models and it creates the Interfaces to implement for your business logic. Furthermore it creates OpenAPI documentation (something missing in this design that is a must for commercial development).
-
Go with PHP
I left PHP for Go.
- with http://sqlc.dev I don't have to write ORM or model code anymore.
- with http://goa.design I can have well-documented API's that any team can generate a client for in any language. It also generates the HTTP JSON and gRPC servers for me so I can focus on my logic.
- with https://github.com/99designs/gqlgen I can define GraphQL revolvers that play well with sqlc (any RDBMS) or I can use a key-value store.
- speaking of key-value stores, Go allows them to be embedded! Even SQLite now has the https://litestream.io/ project to make it super simple to use a durable, always backed-up SQLite database even in a serverless context.
Go is faster, uses less memory, and has really-well designed stdlib without all the bugs I used to face trying to use the PHP stdlib.
-
Do you really need microservices?
Goa and Kong are some of the best frameworks to develop and deploy microservices. They provide features such as out-of-the-box support for service discovery, routing and authentication that make it easier to build more complex applications. There are also newer architectural frameworks with less steep learning curves like GPTDeploy that lets you build and deploy microservices with a single command.
-
Dumb question about APIs, Mux and Go
Or the one we use at work: https://goa.design/ Goa does a lot more and maybe more than you need. We use it as it can generate both REST and gRPC as well as API models and OpenAPI documentation (JSON and YAML).
- Why is gin so popular?
-
Does this project structure make sense?
I typically use Goa for my controller. It makes the API Controller, API models, and OpenAPI Documentation. Making the OpenAPI documentation can be a pain, so this really helps. https://goa.design/
oapi-codegen
-
AsyncAPI Codegen, a code generator from AsyncAPI spec v2 and v3.
During daytime, and especially work time, I used a great tool to generate code from OpenAPI specification: deepmap/oapi-codegen.
-
Created an API using Gin, want to create sdk for him
Then you can use oapi-codegen or openapi-generator to generate the Go (or other language) SDK for it.
-
Create Production-Ready SDKs with Goa
Deepmap OpenAPI code generator
-
Manage DEV Articles with Git and GitHub Actions
Luckily, Forem/DEV is open source and provides great API documentation and specification. I used oapi-codegen to automatically generate a Go API client. Then, I simply had to walk the root articles directory and:
-
oapi-codegen and local refs
I'm using https://github.com/deepmap/oapi-codegen to auto gen some types for my api as I want the contract to be the source of truth. However, I'm running into an issue, the same as (https://stackoverflow.com/questions/77237210/how-to-generate-models-from-openapi-with-ref) where oapi-codegen isn't recognizing references to local files. Has anyone run into this and found a work around? or is there a better tool to use for this
- OpenAPI Client and Server Code Generator for Golang
-
Openapi server generation
For Go, I've found https://github.com/deepmap/oapi-codegen/, and it works well.
-
Combining oapi-codegen, echo and validator frameworks to build robust APIs
I’m using oapi-codegen in my project and I don’t think it ships with a validator.
-
Sharing types between Go backend and TypeScript frontend: best practices and tools?
We're using https://github.com/deepmap/oapi-codegen at work while having an OpenAPI spec. When the spec changes, backend/frontend/mobile regenerate their server/client
- Why is gin so popular?
What are some alternatives?
Gin - Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
openapi-generator - OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
go-kit - A standard library for microservices.
GoSwagger - Swagger 2.0 implementation for go
ogen - OpenAPI v3 code generator for go
Echo - High performance, minimalist Go web framework
kin-openapi - OpenAPI 3.0 (and Swagger v2) implementation for Go (parsing, converting, validation, and more)
gqlgen - go generate based graphql server library
go-oas3 - Open API v3 server code generator
kratos - Your ultimate Go microservices framework for the cloud-native era.
autorest - OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python