swagger-extractor
v1.1.3
Published
Extract axios functions and DTOs from swagger json link
Downloads
700
Maintainers
Readme
swagger-extractor
Extract axios functions and DTOs from swagger json link
Example (files after run npx)
Usage
npx swagger-extractor [options]
Options
--url
*
--name
name use for axios file and folders (default is output
)
--output
output directory (default is /
)
--reactQuery
Generate react-query hooks and keys for each route
--rq
Same as --reactQuery
Output directory structure (without --reactQuery)
after run:
npx swagger-extractor --url="https://petstore.swagger.io/v2/swagger.json" --name="pet"
create folder and file like this:
axios
│ configAxios.ts
| petAxios.ts
│
└───models
│ └───pet
│ │ api-response.ts
│ │ category.ts
│ │ index.ts
│ │ order.ts
│ │ pet.ts
│ │ tag.ts
│ │ update-pet-with-form-request.ts
│ │ upload-file-request.ts
│ │ user.ts
Output directory structure (with --reactQuery)
after run:
npx swagger-extractor --url="https://petstore.swagger.io/v2/swagger.json" --name="pet" --reactQuery
create folder and file like this:
axios
│ configAxios.ts
| petAxios.ts
| constants.ts
│
└───reactQuery
│ └───pet
| | Pet.ts
| | Store.ts
| | User.ts
|
└───models
│ └───pet
│ │ api-response.ts
│ │ category.ts
│ │ index.ts
│ │ order.ts
│ │ pet.ts
│ │ tag.ts
│ │ update-pet-with-form-request.ts
│ │ upload-file-request.ts
│ │ user.ts