0.0.2 • Published 6 months ago
@moccona/apicodegen v0.0.2
@moccona/apicodegen
@moccona/apicodegen
is a command-line tool for generating TypeScript code from OpenAPI documentation. It provides a simple and efficient way to automate the process of creating API clients.
Installation
To install @moccona/apicodegen
, you can use npm or yarn:
npm install -g @moccona/apicodegen
or
```bash
yarn global add @moccona/apicodegen
Usage
Basic Command
The basic command to generate TypeScript code from an OpenAPI documentation URL is as follows:
apicodegen <docURL> --output ./output.ts
<docURL>
: The URL of the OpenAPI documentation file.--output
: The path where the generated TypeScript code will be saved. Default is./output.ts
.--adaptor
: The adaptor for API calls. Default isfetch
.--baseURL
: The base path of the API endpoint.--verbose
: Enable verbose logging.--importClientSource
: The source from which the request tool will be imported.
Example
To generate TypeScript code from an OpenAPI documentation file located at https://api.example.com/openapi.json
and save it to ./src/api.ts
, you can run:
apicodegen https://api.example.com/openapi.json --output ./src/api.ts
Contributing
Contributions are welcome! Please read the contributing guidelines before submitting a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.