Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Typoas – TypeScript OpenAPI client generator (github.com/embraser01)
4 points by embraser01 10 months ago | hide | past | favorite
Hi everyone, I started a couple years ago a new TS OpenAPI generator that would work for any complex OpenAPI specs.

After trying the official openapi generator, I saw that it wasn't capable of generating complex schemas and was generating a lot of skeleton files that could be extracted to a separated package. That's why I started working on an alternative that would handle any complexity provided by OpenAPI specs while still being easy to setup.

Typoas uses the TS AST to generate complex TS types and bundle everything in a single file. Because I wanted to have something as small as possible, I reworked it to be fully tree-shakable and only keep needed parts on bundling.

Like, the official openapi generator, it will transform "dates" to JS Date, handle local refs (even circular). Moreover, it is capable of handling oneOf, allOf or anyOf schemas.

There is more features (like JSDoc of every schemas) that is embedded that I'm eager to discuss!

I created an example with Github, Stripe and the classic Petstore API. It's also used successfully at work in a production environment since the first release. You can try it just using yarn (for example: yarn dlx @typoas/cli generate -i https://raw.githubusercontent.com/github/rest-api-descriptio... -o src/client.ts )

Thanks for checking it out!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: