Hacker News new | ask | show | jobs
by pnwhyc 1958 days ago
My actual recommendation is to use GraphQL instead. But I assume that’s not an option.

OpenAPI is the way to go. The official client generator libraries are fairly consistent in my experience, albeit the design patterns sometimes stray outside ecosystem standards.

Alternatively, you could add JSON-Schema validation & schema endpoints to the API’s, then use a library like QuickType to generate types. Or even setup sample requests for each endpoint then use QuickType to generate types based on the response JSON.

2 comments

Agree with GraphQL. Spin up a Hasura instance, point it at Postgres and you're done.
We don't use GraphQL. I never heard of QuickType before so thanks for that.