@cerios/openapi-to-zod 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +12 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -16
package/dist/cli.mjs
CHANGED
|
@@ -1347,7 +1347,8 @@ var init_property_generator = __esm({
|
|
|
1347
1347
|
});
|
|
1348
1348
|
|
|
1349
1349
|
// src/generator.ts
|
|
1350
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
1350
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
1351
|
+
import { dirname } from "path";
|
|
1351
1352
|
import { parse } from "yaml";
|
|
1352
1353
|
var ZodSchemaGenerator;
|
|
1353
1354
|
var init_generator = __esm({
|
|
@@ -1506,6 +1507,15 @@ var init_generator = __esm({
|
|
|
1506
1507
|
}
|
|
1507
1508
|
return output.join("\n");
|
|
1508
1509
|
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Ensure directory exists for a file path
|
|
1512
|
+
*/
|
|
1513
|
+
ensureDirectoryExists(filePath) {
|
|
1514
|
+
const dir = dirname(filePath);
|
|
1515
|
+
if (!existsSync(dir)) {
|
|
1516
|
+
mkdirSync(dir, { recursive: true });
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1509
1519
|
/**
|
|
1510
1520
|
* Generate the complete output file
|
|
1511
1521
|
*/
|
|
@@ -1517,6 +1527,7 @@ var init_generator = __esm({
|
|
|
1517
1527
|
);
|
|
1518
1528
|
}
|
|
1519
1529
|
const output = this.generateString();
|
|
1530
|
+
this.ensureDirectoryExists(this.options.output);
|
|
1520
1531
|
writeFileSync(this.options.output, output);
|
|
1521
1532
|
}
|
|
1522
1533
|
/**
|