ts-from-swagger
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "ts-from-swagger", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Generate TypeScript interfaces and enums quickly and easily from Swagger definition JSON with our lightweight tool. Improve your development workflow by automatically generating type-safe code that's easy to maintain and understand. Say goodbye to manual coding and hello to streamlined development with our Swagger definition Typescript generator.", | ||
"main": "\\", | ||
"bin": "index.js", | ||
"directories": { | ||
@@ -13,2 +14,3 @@ "test": "test" | ||
"gen": "node index https://petstore.swagger.io/v2/swagger.json ./test/src/definitions", | ||
"npxgen": "npx .", | ||
"ts-from-swagger": "npx ts-from-swagger https://petstore.swagger.io/v2/swagger.json ./test/src/definitions" | ||
@@ -15,0 +17,0 @@ }, |
@@ -11,3 +11,3 @@ # :chopsticks: ts-from-swagger | ||
<img src="https://raw.githubusercontent.com/n4j1Br4ch1D/ts-from-swagger/main/assets/ts-from-swagger.gif" alt="ts-from-swagger" height="600"/> | ||
<img src="https://raw.githubusercontent.com/n4j1Br4ch1D/ts-from-swagger/main/assets/ts-from-swagger.gif" alt="ts-from-swagger" /> | ||
@@ -18,3 +18,3 @@ ## Features | ||
- [x] Simple & Easy to use. | ||
- [x] Fetch directly from Swagger json url. | ||
- [x] Fetch directly from Swagger Schema URL. | ||
- [x] Support interfaces and enums. | ||
@@ -24,3 +24,4 @@ - [x] Support required fields. | ||
- [ ] Authorization for Swagger. | ||
- [ ] Supports both Swagger versions 2 & 3. | ||
- [ ] Supports both OpenAPI versions 2 & 3. | ||
- [ ] Supports both JSON & YML. | ||
@@ -119,5 +120,10 @@ ## Install | ||
- Refactor Code. | ||
- Beta Version 1.0.3 : 17/03/2023 | ||
- Add simple CLI logs. | ||
- Fix run npx: node v14.21.1 / npm v6.14.17 | ||
- [Agenda] Beta Version 1.0.x : xx/03/2023 | ||
- Add Authorization. | ||
- Add support for Swagger version 3. | ||
- Add support for YML. | ||
- Fix issue: npx command on later node/npm versions. | ||
``` | ||
@@ -124,0 +130,0 @@ |
@@ -7,2 +7,3 @@ import fs from "fs"; | ||
export async function generateInterfaces(swaggerUrl, outputDir) { | ||
console.log("🥢ts-from-swagger: ", "Start generating...!"); | ||
return new Promise(async (resolve) => { | ||
@@ -17,2 +18,3 @@ const requester = swaggerUrl.startsWith("http://") ? http : https; | ||
response.on("end", async () => { | ||
console.log("🥢ts-from-swagger: ", "Schema fetched successfully!"); | ||
const swagger = await JSON.parse(data); | ||
@@ -94,2 +96,3 @@ const definitions = swagger.definitions; | ||
} | ||
console.log("🥢ts-from-swagger: ", "Definitions generated successfully!"); | ||
resolve("resolved"); | ||
@@ -99,5 +102,5 @@ }); | ||
.on("error", (error) => { | ||
console.error(error); | ||
console.error("🥢ts-from-swagger: ", error); | ||
}); | ||
}); | ||
} |
12929
104
140