Skip to content

Commit 66612c7

Browse files
authored
Update ReadMe.md
1 parent 067c855 commit 66612c7

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

ReadMe.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# openapi-toolkit
2+
openapi-toolkit is an open-source tool designed to streamline the integration of OpenAPI (formerly known as Swagger) specifications into your development workflow. By taking an OpenAPI/Swagger file as input, the OpenAPI Toolkit automatically generates server and client code, enabling seamless integration of APIs. This automation accelerates development processes, ensures consistency across different platforms, and reduces the risk of manual errors. Whether you're building a new service or integrating with existing APIs, OpenAPI Toolkit simplifies the process by providing ready-to-use code tailored to your OpenAPI specifications.
3+
14
# Install
25

36
[![Run Tests](https://github.com/barnuri/openapi-toolkit/actions/workflows/runTests.yaml/badge.svg)](https://github.com/barnuri/openapi-toolkit/actions/workflows/runTests.yaml) [![Create Tag And Release And Publish To NPM](https://github.com/barnuri/openapi-toolkit/actions/workflows/createTagAndReleaseAndPublish.yaml/badge.svg)](https://github.com/barnuri/openapi-toolkit/actions/workflows/createTagAndReleaseAndPublish.yaml)
@@ -23,6 +26,30 @@ openapi-toolkit -h
2326
docker run --rm --name openapi-toolkit -v "$(pwd)/output:/output" -e CLI_PARAMS="-i https://petstore3.swagger.io/api/v3/openapi.json -g typescript-axios --modelNamePrefix My --modelNameSuffix .dto" barnuri/openapi-toolkit
2427
```
2528

29+
# Auto Generate Client/Server (JS\TS)
30+
31+
```js
32+
const { multipleGenerate, generate } = require('openapi-toolkit');
33+
34+
// use multipleGenerate when you want multiple outputs
35+
(async () => {
36+
const sharedConfig = { debugLogs: false };
37+
await multipleGenerate(`https://petstore3.swagger.io/api/v3/openapi.json`, [
38+
{ ...sharedConfig, generator: 'typescript-react-query', output: `./typescript-react-query/src` },
39+
{ ...sharedConfig, generator: 'typescript-axios', output: `./typescript-axios/src` },
40+
{ ...sharedConfig, generator: 'typescript-axios', output: `./typescript-models/src`, modelsOnly: true },
41+
{ ...sharedConfig, generator: 'c#', output: `./c#/src`, },
42+
{ ...sharedConfig, generator: 'go', output: `./go/src` },
43+
{ ...sharedConfig, generator: 'python', output: `./python/src` },
44+
]);
45+
})();
46+
47+
// use generate when you want only one output
48+
(async () => {
49+
await generate({ pathOrUrl: `https://petstore3.swagger.io/api/v3/openapi.json`, generator: 'typescript-react-query', output: `./typescript-react-query/src` });
50+
})();
51+
```
52+
2653
### Help output
2754

2855
```text

0 commit comments

Comments
 (0)