Generates TypeScript REST API client from OpenAPI spec.
Install Deno. Deno is like node.js, but better.
Run the following command at the command prompt:
deno types > lib.deno.d.ts
deno run --allow-read --allow-net client-gen.ts swagger.json > RestClient.ts
In the above example, the definition comes from swagger.json
but you can also supply a URL instead.
The output is written to stdout, which is redirected to RestClient.ts
.
The generated code requires you to supply a wrapper function for fetch
. One is provided here.