@ng-openapi/http-resource 0.0.18 → 0.0.19

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/index.cjs +5 -1
  2. package/index.js +5 -1
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -100,6 +100,10 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
100
100
  case "null":
101
101
  return "null";
102
102
  default:
103
+ if (Array.isArray(schema2.type)) {
104
+ const types = schema2.type.map((t) => getTypeScriptType(t, config, void 0, void 0, context));
105
+ return nullableType(types.join(" | "), nullable);
106
+ }
103
107
  return nullableType("any", nullable);
104
108
  }
105
109
  }
@@ -281,7 +285,7 @@ function inferResponseTypeFromContentType(contentType) {
281
285
  }
282
286
  return "text";
283
287
  }
284
- if (normalizedType === "application/x-www-form-urlencoded" || normalizedType === "multipart/form-data") {
288
+ if (normalizedType === "CONTENT_TYPES.FORM_URLENCODED" || normalizedType === "multipart/form-data") {
285
289
  return "text";
286
290
  }
287
291
  if (normalizedType === "application/javascript" || normalizedType === "application/typescript" || normalizedType === "application/css" || normalizedType === "application/yaml" || normalizedType === "application/x-yaml" || normalizedType === "application/toml") {
package/index.js CHANGED
@@ -66,6 +66,10 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
66
66
  case "null":
67
67
  return "null";
68
68
  default:
69
+ if (Array.isArray(schema2.type)) {
70
+ const types = schema2.type.map((t) => getTypeScriptType(t, config, void 0, void 0, context));
71
+ return nullableType(types.join(" | "), nullable);
72
+ }
69
73
  return nullableType("any", nullable);
70
74
  }
71
75
  }
@@ -247,7 +251,7 @@ function inferResponseTypeFromContentType(contentType) {
247
251
  }
248
252
  return "text";
249
253
  }
250
- if (normalizedType === "application/x-www-form-urlencoded" || normalizedType === "multipart/form-data") {
254
+ if (normalizedType === "CONTENT_TYPES.FORM_URLENCODED" || normalizedType === "multipart/form-data") {
251
255
  return "text";
252
256
  }
253
257
  if (normalizedType === "application/javascript" || normalizedType === "application/typescript" || normalizedType === "application/css" || normalizedType === "application/yaml" || normalizedType === "application/x-yaml" || normalizedType === "application/toml") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-openapi/http-resource",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "HTTP Resource plugin for ng-openapi - Angular HTTP utilities with caching and state management",
5
5
  "keywords": [
6
6
  "angular",