@sebspark/openapi-typegen 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -182,7 +182,7 @@ var generateType = (parsed) => {
182
182
  };
183
183
  var generateProperty = (property) => {
184
184
  const types = property.type.map(generateType);
185
- return `${document(property)}${propertyName(property.name)}${property.optional ? "?" : ""}: ${types.join(OR)}`;
185
+ return `${document(property)}${propertyName(property.name)}${property.optional ? "?" : ""}: ${types.join(OR) || "unknown"}`;
186
186
  };
187
187
  var preamble = (type) => type.name ? `${document(type)}export type ${typeName(type.name)} = ` : "";
188
188
  var typeName = (name) => {
@@ -514,6 +514,15 @@ var parsePropertyType = (property) => {
514
514
  }
515
515
  });
516
516
  }
517
+ if (schemaObject.allOf) {
518
+ const types = [];
519
+ for (const allOf of schemaObject.allOf) {
520
+ const type = parseSchema(void 0, allOf);
521
+ delete type.name;
522
+ types.push(type);
523
+ }
524
+ return types;
525
+ }
517
526
  return [];
518
527
  };
519
528
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/openapi-typegen",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "boxen": "<6",
28
28
  "chalk": "<5",
29
29
  "change-case": "4.1.2",
30
- "prettier": "3.2.3",
30
+ "prettier": "3.2.4",
31
31
  "yaml": "2.3.4",
32
32
  "yargs": "17.7.2",
33
33
  "yarn": "1.22.21"