ไธญๆ็ฎไฝ | English
Generate typescript code from swagger(v3) JSON.
It will generate a typescript definition and fetch-based api client. all most out of box.
It can be applied to most scenarios, strengthen your interface calls, and eliminate annoying type declarations.
Here are some generated exquisite examples to see if it meets your taste.
install via Deno
deno install \
-A \
--no-check \
--reload \
-f \
https://github.com/axetroy/swagger2ts/raw/v0.2.26/swagger2ts.ts
or install via npm
npm install -g @axetroy/swagger2ts
swagger2ts swagger.json > api.ts
swagger2ts https://example.com/swagger.json > api.ts
import { generate } from "@axetroy/swagger2ts";
const output = await generate("/path/to/swagger.json");
// const output = await generate("https://example.com/swagger.json");
console.log(output);
import { generate } from "https://github.com/axetroy/swagger2ts/raw/v0.2.26/generate.ts";
const output = await generate("/path/to/swagger.json");
// const output = await generate("https://example.com/swagger.json");
console.log(output);
The MIT License