Follow

Anyone have tips on how to codegen an OpenAPI consumer for Ruby? Started working with insomniac to define and test a REST API but I'm just about to access it from and would like to do it right.

· · Web · 1 · 2 · 0

@seachanged Might be. I know it's not too hard to generate individual snippets in whatever language. Guess it's going to boil down to the usual of looking at how it's been done and emulating that.

@weex

The language-to-language support for the swagger codegen utility is uneven: it's fantastic for JAVA, but uneven and very framework based for PHP, for example.

The semantics are often idiosyncratic, as well. I could never find concise translation specifications docs.

As a starting point, you might just have to create or obtain your OpenAPI yaml or JSON, install swagger codegen, and get to work seeing what it generates and how it supports you, and how to interface your code with its.

@seachanged Yes! I'm very early with this so thought it would be good to chat about. Was just returning to an idea a couple days ago and was like... I'm sure there's a better way than a readme doc to do APIs and found OAS. In my last job people used Postman a lot so this has been fun playing with Insomniac and developing the yaml spec.

@weex

You're right, it is a better way.

You still might need the readme, because there are a lot of API semantics that cannot be expressed in the OpenAPI schema, but the nesting and naming can telegraph a lot of information that cannot be expressed in the syntax; and the description fields should be well used.

There is also a degree of pure expression in creating the OpenAPI spec that takes me to the quiet place where things get done, and I like that very much.

Sign in to participate in the conversation
Ecko / c4.social

Creating magic through evolution of the Fediverse. Running Ecko, a community-driven fork of Mastodon managed using the Collective Code Construction Contract (C4) by the Magic Stone Community. C4 is a protocol for asynchronous, non-blocking, distributed, problem-focused software development.