Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omermecitoglu/ts-openapi-interface-generator
OpenAPI interface generator for TypeScript
https://github.com/omermecitoglu/ts-openapi-interface-generator
cli codegen generator interface openapi typescript
Last synced: about 1 month ago
JSON representation
OpenAPI interface generator for TypeScript
- Host: GitHub
- URL: https://github.com/omermecitoglu/ts-openapi-interface-generator
- Owner: omermecitoglu
- License: mit
- Created: 2024-03-08T05:49:15.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-21T08:10:24.000Z (8 months ago)
- Last Synced: 2024-09-27T07:48:23.665Z (about 2 months ago)
- Topics: cli, codegen, generator, interface, openapi, typescript
- Language: TypeScript
- Homepage:
- Size: 160 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAPI Interface Generator
Provides an npm command to generate TypeScript code for services defined in a source JSON file.
## Installation
```bash
npm install @omer-x/ts-openapi-interface-generator
```## Usage
1. Ensure you have a `source.json` file in the root directory of your project with the following structure:
```json
{
"services": [
{
"name": "ExampleService",
"url": "https://example.com/api",
"specs": "/swagger"
}
]
}
```2. Run the following command to generate code for each service defined in `source.json`:
```bash
npx generate-service-interfaces
```This will generate code in the `src` folder for each service.
## Configuration
You can customize the source JSON file by specifying additional properties for each service:
- `name`: The name of the service.
- `url`: The URL of the service.
- `specs` (optional): The path to the OpenAPI specifications. Default value is "/swagger".## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.