OpenAPI and Go

273 views
Skip to first unread message

Alex Pliutau

unread,
Mar 3, 2025, 5:01:45 AMMar 3
to golang-nuts
Are you folks using OpenAPI when developing API in Go?

What generators do you use?


Shaun Houlihan

unread,
Mar 4, 2025, 1:03:05 AMMar 4
to golang-nuts
Hi Alex,

Yes, I use OpenAPI all the time for doing API-first development in Go. This is the go-to generator currently, as far as I'm aware: https://github.com/oapi-codegen/oapi-codegen

It is very comprehensive, though in my opinion a bit configuration heavy and not quite strict enough.

I'm working on an alternative generator that is a bit more 'light-weight', but I don't have a timeline yet for when it will be available.

-Shaun

Hannah Bamgbelu

unread,
Mar 6, 2025, 8:36:09 AMMar 6
to golang-nuts
This is a cry for help! I cannot seem to go forward in my Go lessons. I am very stuck in APIs. As I do not have prior experience in this, it is so disheartening because this is something I need to learn

Christoph Berger

unread,
Mar 7, 2025, 4:48:03 AMMar 7
to golang-nuts
I briefly examined four approaches a while ago (https://appliedgo.net/spotlight/4-tools-for-generating-rest-apis/)—two spec-to-code and two code-to-spec approaches. I still found no time to run deeper experiments with any of them, though. 

Sergey Mogilnikov

unread,
Mar 7, 2025, 7:46:05 PMMar 7
to golang-nuts
API-first, create specification, than generate all the code with ogen.

https://github.com/ogen-go/ogen

Generate models, controllers, etc. Fully compatible with std `http` lib.

пятница, 7 марта 2025 г. в 12:48:03 UTC+3, Christoph Berger:
Reply all
Reply to author
Forward
0 new messages