- Status: proposed (not all options are fully evaluated)
- Date: 2021-03-29
OpenAPI (formerly Swagger) is a way to describe a REST API. It has slowly become a business standard, used by large tech companies as well as small. The Open Source community has built the OpenAPI specification to improve the reliability of REST APIs, with it you can define types and methods of an API. The community has also built tools to generate server and client code for these APIs.
The benefits of code generators are obviously having to write less code. There are many alternatives to generate clients, based on OpenAPI – most of them have issues. The issues are typically unorganized source code, being unmaintaned, outdated targets (the generated Typescript code is outdated) or being unfinished. These issues are the fundation of this proposal, which is essentially rewriting/building a OpenAPI to Typescript client generator.
We cannot find a OpenAPI Generator that is maintained, has updated targes and is well-organized. Typescript clients generated by the available OpenAPI Generators are consequently outdated and less desirable to use. Users end up writing clients manually 👀
- Utilize modern Typescript (e.g. we don't want
request
as a dependency) - Runtype validation for static types (runtypes, iots etc.)
- We don't want to maintain a bunch of code, we want to reuse what is already there.
- Support all OpenAPI versions (at least the latest)
- Use some form of CodeWriter which can be updated instead of a template (?)
- Add features to create specific input/output types (for OpenAPI specs that are weird)
Either contribute or fork one of these:
- https://github.com/technocreatives/openapi-eller
- https://github.com/drwpow/openapi-typescript
- https://github.com/OpenAPITools/openapi-generator
- https://github.com/Mermade/openapi-codegen
- https://github.com/PaulDLW/typescript-openapi-generator
- https://github.com/openapi-contrib/openapi3-generator
- https://github.com/foxel/openapi3-typescript-codegen
- https://github.com/ferdikoomen/openapi-typescript-codegen
- Write yet another OpenAPI Generator?