ng-openapi 0.2.8 → 0.2.10-pr-53-bugfix-resolve-non-object-types-c28cad9.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 (3) hide show
  1. package/cli.cjs +15 -3
  2. package/index.js +14 -2
  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.7";
47
+ var version = "0.2.9";
48
48
 
49
49
  // src/lib/core/generator.ts
50
50
  var import_ts_morph7 = require("ts-morph");
@@ -620,8 +620,19 @@ var TypeGenerator = class {
620
620
  this.collectCompositeTypeStructure(interfaceName, definition);
621
621
  } else if (definition.items) {
622
622
  this.collectArrayTypeStructure(interfaceName, definition);
623
- } else {
623
+ } else if (definition.properties) {
624
624
  this.collectInterfaceStructure(interfaceName, definition);
625
+ } else {
626
+ const propertyType = this.resolveSwaggerTypeCached(definition);
627
+ this.statements.push({
628
+ kind: import_ts_morph.StructureKind.TypeAlias,
629
+ name: interfaceName,
630
+ isExported: true,
631
+ docs: definition.description ? [
632
+ definition.description
633
+ ] : void 0,
634
+ type: propertyType
635
+ });
625
636
  }
626
637
  }
627
638
  collectEnumStructure(name, definition) {
@@ -1844,7 +1855,8 @@ var HttpParamsBuilderGenerator = class {
1844
1855
  "Adds a value to HttpParams. Delegates to recursive handler for objects/arrays."
1845
1856
  ],
1846
1857
  statements: `const isDate = value instanceof Date;
1847
- const isObject = typeof value === "object" && !isDate;
1858
+ const isArray = Array.isArray(value);
1859
+ const isObject = typeof value === "object" && !isDate && !isArray;
1848
1860
 
1849
1861
  if (isObject) {
1850
1862
  return this.addToHttpParamsRecursive(httpParams, value);
package/index.js CHANGED
@@ -736,8 +736,19 @@ var _TypeGenerator = class _TypeGenerator {
736
736
  this.collectCompositeTypeStructure(interfaceName, definition);
737
737
  } else if (definition.items) {
738
738
  this.collectArrayTypeStructure(interfaceName, definition);
739
- } else {
739
+ } else if (definition.properties) {
740
740
  this.collectInterfaceStructure(interfaceName, definition);
741
+ } else {
742
+ const propertyType = this.resolveSwaggerTypeCached(definition);
743
+ this.statements.push({
744
+ kind: import_ts_morph.StructureKind.TypeAlias,
745
+ name: interfaceName,
746
+ isExported: true,
747
+ docs: definition.description ? [
748
+ definition.description
749
+ ] : void 0,
750
+ type: propertyType
751
+ });
741
752
  }
742
753
  }
743
754
  collectEnumStructure(name, definition) {
@@ -1965,7 +1976,8 @@ var _HttpParamsBuilderGenerator = class _HttpParamsBuilderGenerator {
1965
1976
  "Adds a value to HttpParams. Delegates to recursive handler for objects/arrays."
1966
1977
  ],
1967
1978
  statements: `const isDate = value instanceof Date;
1968
- const isObject = typeof value === "object" && !isDate;
1979
+ const isArray = Array.isArray(value);
1980
+ const isObject = typeof value === "object" && !isDate && !isArray;
1969
1981
 
1970
1982
  if (isObject) {
1971
1983
  return this.addToHttpParamsRecursive(httpParams, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-openapi",
3
- "version": "0.2.8",
3
+ "version": "0.2.10-pr-53-bugfix-resolve-non-object-types-c28cad9.0",
4
4
  "description": "Generate Angular services and TypeScript types from OpenAPI/Swagger specifications",
5
5
  "keywords": [
6
6
  "ng-openapi",