openapi-sync 1.0.22 → 1.0.24

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.
@@ -198,7 +198,7 @@ const parseSchemaToType = (apiDoc, schema, name, isRequired, options) => {
198
198
  else if (schema.type === "object") {
199
199
  //Since we would have already parsed the object keys above "schema.properties" if it exists
200
200
  if (schema.additionalProperties) {
201
- type += `{[k: string]: ${(0, exports.parseSchemaToType)(apiDoc, schema.additionalProperties, "", true, options)}}`;
201
+ type += `{[k: string]: ${(0, exports.parseSchemaToType)(apiDoc, schema.additionalProperties, "", true, options) || "any"}}`;
202
202
  }
203
203
  else {
204
204
  type += "{[k: string]: any}";
@@ -7,7 +7,14 @@ exports.resetState = exports.getState = exports.setState = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const dbPath = path_1.default.join(__dirname, "../", "../db.json");
10
- let state = require(dbPath);
10
+ let db = {};
11
+ try {
12
+ db = require(dbPath);
13
+ }
14
+ catch (error) {
15
+ db = {};
16
+ }
17
+ let state = db || {};
11
18
  const updateDB = (data) => {
12
19
  fs_1.default.writeFileSync(dbPath, JSON.stringify(data));
13
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-sync",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "A developer-friendly tool designed to keep your API up-to-date by leveraging OpenAPI schemas. It automates the generation of endpoint URIs and type definitions, including shared types, directly from your OpenAPI specification.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",