Magical SDK generation from an OpenAPI definition 🪄
api
is a library that facilitates creating an SDK from an OpenAPI definition. You can use its codegen offering to create an opinionated SDK for TypeScript or JS (+ TypeScript types).
$ npx api install https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json
const petstore = require('@api/petstore');
petstore.listPets().then(({ data }) => {
console.log(`My pets name is ${data[0].name}!`);
});
The ESM syntax is supported as well:
import petstore from '@api/petstore';
petstore.listPets().then(({ data }) => {
console.log(`My pets name is ${data[0].name}!`);
});
7.0.0-beta.11 (2024-11-18)
- fix: use correct import attributes syntax (#957) (211e8fd), closes #957
- fix: use dynamic import for node-specific libraries (#820) (b338098), closes #820
- chore(deps-dev): bump the minor-development-deps group with 5 updates (#951) (353cd8b), closes #951
- chore(deps): bump @readme/oas-to-har from 24.0.0 to 24.0.1 (#952) (0e736af), closes #952
- chore(deps): bump oas from 25.0.2 to 25.0.3 (#956) (6d42c56), closes #956
- chore(deps): bump ts-morph from 23.0.0 to 24.0.0 (#953) (f70973c), closes #953