|
1 | | -# OpenAPI Interface Generator |
| 1 | +# Next OpenAPI Interface Generator |
2 | 2 |
|
3 | | -Provides an npm command to generate TypeScript code for services defined in a source JSON file. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +This script automates the generation of documentation and TypeScript interfaces for a service, making it easier to maintain and interact with the service in a TypeScript environment. |
4 | 7 |
|
5 | 8 | ## Installation |
6 | 9 |
|
7 | 10 | ```bash |
8 | | -npm install @omer-x/ts-openapi-interface-generator |
| 11 | +npm install @omer-x/next-openapi-interface-generator |
9 | 12 | ``` |
10 | 13 |
|
11 | 14 | ## Usage |
12 | 15 |
|
13 | | -1. Ensure you have a `source.json` file in the root directory of your project with the following structure: |
14 | | - |
15 | | -```json |
16 | | -{ |
17 | | - "services": [ |
18 | | - { |
19 | | - "name": "ExampleService", |
20 | | - "url": "https://example.com/api", |
21 | | - "specs": "/swagger" |
22 | | - } |
23 | | - ] |
24 | | -} |
| 16 | +```bash |
| 17 | +generate-service-interface --source <source_directory> --output <output_directory> |
25 | 18 | ``` |
26 | 19 |
|
27 | | -2. Run the following command to generate code for each service defined in `source.json`: |
| 20 | +### Options |
28 | 21 |
|
29 | | -```bash |
30 | | -npx generate-service-interfaces |
31 | | -``` |
| 22 | +- `--source`, `-s`: Specify the source directory. Default: `src` |
| 23 | +- `--output`, `-o`: Specify the output directory. Default: `dist` |
32 | 24 |
|
33 | | -This will generate code in the `src` folder for each service. |
| 25 | +## Example |
34 | 26 |
|
35 | | -## Configuration |
| 27 | +```bash |
| 28 | +generate-service-interface --source src/app --output dist |
| 29 | +``` |
36 | 30 |
|
37 | | -You can customize the source JSON file by specifying additional properties for each service: |
| 31 | +## Contributing |
38 | 32 |
|
39 | | -- `name`: The name of the service. |
40 | | -- `url`: The URL of the service. |
41 | | -- `specs` (optional): The path to the OpenAPI specifications. Default value is "/swagger". |
| 33 | +Contributions are welcome! Please feel free to submit a pull request or open an issue if you find any bugs or have any suggestions for improvement. |
42 | 34 |
|
43 | 35 | ## License |
44 | 36 |
|
|
0 commit comments