@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.js
CHANGED
|
@@ -73,6 +73,7 @@ var ConfigurationError = class extends GeneratorError {
|
|
|
73
73
|
|
|
74
74
|
// src/generator.ts
|
|
75
75
|
var import_node_fs = require("fs");
|
|
76
|
+
var import_node_path = require("path");
|
|
76
77
|
var import_yaml = require("yaml");
|
|
77
78
|
|
|
78
79
|
// src/utils/name-utils.ts
|
|
@@ -1404,6 +1405,15 @@ var ZodSchemaGenerator = class {
|
|
|
1404
1405
|
}
|
|
1405
1406
|
return output.join("\n");
|
|
1406
1407
|
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Ensure directory exists for a file path
|
|
1410
|
+
*/
|
|
1411
|
+
ensureDirectoryExists(filePath) {
|
|
1412
|
+
const dir = (0, import_node_path.dirname)(filePath);
|
|
1413
|
+
if (!(0, import_node_fs.existsSync)(dir)) {
|
|
1414
|
+
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1407
1417
|
/**
|
|
1408
1418
|
* Generate the complete output file
|
|
1409
1419
|
*/
|
|
@@ -1415,6 +1425,7 @@ var ZodSchemaGenerator = class {
|
|
|
1415
1425
|
);
|
|
1416
1426
|
}
|
|
1417
1427
|
const output = this.generateString();
|
|
1428
|
+
this.ensureDirectoryExists(this.options.output);
|
|
1418
1429
|
(0, import_node_fs.writeFileSync)(this.options.output, output);
|
|
1419
1430
|
}
|
|
1420
1431
|
/**
|