ng-openapi 0.2.6 → 0.2.7

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 (3) hide show
  1. package/cli.cjs +15 -1
  2. package/index.js +14 -0
  3. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -44,7 +44,7 @@ var fs4 = __toESM(require("fs"));
44
44
  var path12 = __toESM(require("path"));
45
45
 
46
46
  // package.json
47
- var version = "0.2.5";
47
+ var version = "0.2.6";
48
48
 
49
49
  // src/lib/core/generator.ts
50
50
  var import_ts_morph7 = require("ts-morph");
@@ -618,6 +618,8 @@ var TypeGenerator = class {
618
618
  this.collectEnumStructure(interfaceName, definition);
619
619
  } else if (definition.allOf) {
620
620
  this.collectCompositeTypeStructure(interfaceName, definition);
621
+ } else if (definition.items) {
622
+ this.collectArrayTypeStructure(interfaceName, definition);
621
623
  } else {
622
624
  this.collectInterfaceStructure(interfaceName, definition);
623
625
  }
@@ -725,6 +727,18 @@ var TypeGenerator = class {
725
727
  ] : void 0
726
728
  });
727
729
  }
730
+ collectArrayTypeStructure(name, definition) {
731
+ const itemType = definition.items ? this.getArrayItemType(definition.items) : "unknown";
732
+ this.statements.push({
733
+ kind: import_ts_morph.StructureKind.TypeAlias,
734
+ name,
735
+ isExported: true,
736
+ docs: definition.description ? [
737
+ definition.description
738
+ ] : void 0,
739
+ type: `Array<${itemType}>`
740
+ });
741
+ }
728
742
  collectInterfaceStructure(name, definition) {
729
743
  const properties = this.buildInterfaceProperties(definition);
730
744
  this.statements.push({
package/index.js CHANGED
@@ -734,6 +734,8 @@ var _TypeGenerator = class _TypeGenerator {
734
734
  this.collectEnumStructure(interfaceName, definition);
735
735
  } else if (definition.allOf) {
736
736
  this.collectCompositeTypeStructure(interfaceName, definition);
737
+ } else if (definition.items) {
738
+ this.collectArrayTypeStructure(interfaceName, definition);
737
739
  } else {
738
740
  this.collectInterfaceStructure(interfaceName, definition);
739
741
  }
@@ -845,6 +847,18 @@ var _TypeGenerator = class _TypeGenerator {
845
847
  ] : void 0
846
848
  });
847
849
  }
850
+ collectArrayTypeStructure(name, definition) {
851
+ const itemType = definition.items ? this.getArrayItemType(definition.items) : "unknown";
852
+ this.statements.push({
853
+ kind: import_ts_morph.StructureKind.TypeAlias,
854
+ name,
855
+ isExported: true,
856
+ docs: definition.description ? [
857
+ definition.description
858
+ ] : void 0,
859
+ type: `Array<${itemType}>`
860
+ });
861
+ }
848
862
  collectInterfaceStructure(name, definition) {
849
863
  const properties = this.buildInterfaceProperties(definition);
850
864
  this.statements.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-openapi",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Generate Angular services and TypeScript types from OpenAPI/Swagger specifications",
5
5
  "keywords": [
6
6
  "ng-openapi",