Add a Generator
TypeScript​
We want to generate TypeScript types and interfaces that represent our source service definition. We'll continue by installing the @basketry/typescript
generator:
- npm
- yarn
- pnpm
npm install @basketry/typescript
yarn add @basketry/typescript
pnpm add @basketry/typescript
Update the configuration​
Update the generators
property in your basketry.config.json
file to include the @basketry/typescript
generator. Also update the output
property to point to the directory where you want to save the generated files:
basketry.config.json
{
"source": "petstore.json",
"parser": "@basketry/openapi-3",
"rules": [],
"generators": ["@basketry/typescript"],
"output": "src",
"options": {
"basketry": {}
}
}
info
Learn more about the generators that Basketry provides by checking out the generator components.
At this point we have a servicer definition with a matching parser and generator. Next, we'll create a script to generate some code!