Show HN: Turn OpenAPI to Universal TypeScript SDKs(speakeasyapi.dev) Hi HN! We’re excited to share our new code generator that lets you ship high-quality TypeScript SDKs, that your users will love, from your OpenAPI documents. Our ongoing goal is to help you build one SDK that runs anywhere modern JavaScript runs. This includes new runtimes like Deno and Bun in addition to the ever-popular Node.js. Additionally, the popularity of AI has meant server-sent events and file streaming are also commonplace - we wanted to cover these use cases too. This explosion in new runtimes and ways of interacting with APIs shifts cognitive burden on API developers often having to work with different technologies when integrating an API. At Speakeasy we set out to create a “Universal Typescript SDK” that would work across browser, servers and other runtimes. There are a number of open source generators out there but none of them provided enough coverage across the variety of APIs we see modelled with OpenAPI. Some of the requirements we tried to hit in this release: - Compatibility with the browser & server - Support for popular, backend JavaScript runtimes including Node.js, Bun, Deno - User input and server response validation with Zod - Support for polymorphic types, also known as unions or `oneOf` in OpenAPI. - Support for constant and default values, big integers and decimals - Support for multipart streaming upload - Support for server sent events using native OpenAPI constructs We want to give a special shout out to Zod because it served as a great foundation for translating all the JSON Schema primitives used in OpenAPI into TypeScript types that you can trust. By this we mean that the types are backed by runtime validation so vanilla JS users have a safeguard and servers that drift from their OpenAPI spec are caught instead of silently failing or triggering obscure runtime errors. If you’re curious to dive into our learnings check out this post https://www.speakeasyapi.dev/post/how-we-built-universal-ts We’d love for folks to check out our new generator and give us feedback. Its really easy to get started. Install our CLI with `brew install speakeasy-api/homebrew-tap/speakeasy` and run `speakeasy generate sdk -s openapi.yaml --output ./sdk -l typescript` . If you want to chat directly with us you can reach us on slack : https://join.slack.com/t/speakeasy-dev/shared_invite/zt-1cwb... . |