@ng-openapi/zod 0.0.2 → 0.0.3
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.
- package/index.cjs +9 -2
- package/index.js +9 -2
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -97,6 +97,13 @@ function parseParameters(operationParams, pathParams) {
|
|
|
97
97
|
}
|
|
98
98
|
__name(parseParameters, "parseParameters");
|
|
99
99
|
|
|
100
|
+
// ../../shared/src/utils/content-types.constants.ts
|
|
101
|
+
var CONTENT_TYPES = {
|
|
102
|
+
MULTIPART: "multipart/form-data",
|
|
103
|
+
FORM_URLENCODED: "application/x-www-form-urlencoded",
|
|
104
|
+
JSON: "application/json"
|
|
105
|
+
};
|
|
106
|
+
|
|
100
107
|
// ../../shared/src/config/constants.ts
|
|
101
108
|
var disableLinting = `/* @ts-nocheck */
|
|
102
109
|
/* eslint-disable */
|
|
@@ -3137,7 +3144,7 @@ var ZodSchemaGenerator = class {
|
|
|
3137
3144
|
return statements;
|
|
3138
3145
|
}
|
|
3139
3146
|
const requestBody = this.resolveRequestBody(operation.requestBody);
|
|
3140
|
-
const content = requestBody.content?.[
|
|
3147
|
+
const content = requestBody.content?.[CONTENT_TYPES.JSON] || requestBody.content?.["multipart/form-data"];
|
|
3141
3148
|
if (!content?.schema) {
|
|
3142
3149
|
return statements;
|
|
3143
3150
|
}
|
|
@@ -3181,7 +3188,7 @@ var ZodSchemaGenerator = class {
|
|
|
3181
3188
|
for (const [statusCode, response] of responsesToGenerate) {
|
|
3182
3189
|
if (!response) continue;
|
|
3183
3190
|
const resolvedResponse = this.resolveResponse(response);
|
|
3184
|
-
const content = resolvedResponse.content?.[
|
|
3191
|
+
const content = resolvedResponse.content?.[CONTENT_TYPES.JSON];
|
|
3185
3192
|
if (!content?.schema) continue;
|
|
3186
3193
|
const schema2 = this.resolveSchema(content.schema);
|
|
3187
3194
|
const responseName = statusCode ? `${operationName}${statusCode}Response` : `${operationName}Response`;
|
package/index.js
CHANGED
|
@@ -63,6 +63,13 @@ function parseParameters(operationParams, pathParams) {
|
|
|
63
63
|
}
|
|
64
64
|
__name(parseParameters, "parseParameters");
|
|
65
65
|
|
|
66
|
+
// ../../shared/src/utils/content-types.constants.ts
|
|
67
|
+
var CONTENT_TYPES = {
|
|
68
|
+
MULTIPART: "multipart/form-data",
|
|
69
|
+
FORM_URLENCODED: "application/x-www-form-urlencoded",
|
|
70
|
+
JSON: "application/json"
|
|
71
|
+
};
|
|
72
|
+
|
|
66
73
|
// ../../shared/src/config/constants.ts
|
|
67
74
|
var disableLinting = `/* @ts-nocheck */
|
|
68
75
|
/* eslint-disable */
|
|
@@ -3103,7 +3110,7 @@ var ZodSchemaGenerator = class {
|
|
|
3103
3110
|
return statements;
|
|
3104
3111
|
}
|
|
3105
3112
|
const requestBody = this.resolveRequestBody(operation.requestBody);
|
|
3106
|
-
const content = requestBody.content?.[
|
|
3113
|
+
const content = requestBody.content?.[CONTENT_TYPES.JSON] || requestBody.content?.["multipart/form-data"];
|
|
3107
3114
|
if (!content?.schema) {
|
|
3108
3115
|
return statements;
|
|
3109
3116
|
}
|
|
@@ -3147,7 +3154,7 @@ var ZodSchemaGenerator = class {
|
|
|
3147
3154
|
for (const [statusCode, response] of responsesToGenerate) {
|
|
3148
3155
|
if (!response) continue;
|
|
3149
3156
|
const resolvedResponse = this.resolveResponse(response);
|
|
3150
|
-
const content = resolvedResponse.content?.[
|
|
3157
|
+
const content = resolvedResponse.content?.[CONTENT_TYPES.JSON];
|
|
3151
3158
|
if (!content?.schema) continue;
|
|
3152
3159
|
const schema2 = this.resolveSchema(content.schema);
|
|
3153
3160
|
const responseName = statusCode ? `${operationName}${statusCode}Response` : `${operationName}Response`;
|