@elysiajs/openapi 1.4.5 → 1.4.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.
- package/dist/cjs/gen/index.js +1 -1
- package/dist/cjs/index.js +14 -2
- package/dist/cjs/openapi.js +14 -2
- package/dist/gen/index.mjs +1 -1
- package/dist/index.mjs +14 -2
- package/dist/openapi.mjs +14 -2
- package/package.json +1 -1
package/dist/cjs/gen/index.js
CHANGED
|
@@ -8465,7 +8465,7 @@ var fromTypes = (targetFilePath, {
|
|
|
8465
8465
|
);
|
|
8466
8466
|
const routes = {};
|
|
8467
8467
|
for (const route of extractRootObjects(routesString)) {
|
|
8468
|
-
let schema = TypeBox(route);
|
|
8468
|
+
let schema = TypeBox(route.replaceAll(/readonly/g, ""));
|
|
8469
8469
|
if (schema.type !== "object") continue;
|
|
8470
8470
|
const paths = [];
|
|
8471
8471
|
while (true) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -462,8 +462,19 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
462
462
|
))
|
|
463
463
|
if (isValidSchema(schema)) {
|
|
464
464
|
if (!hooks.response) hooks.response = {};
|
|
465
|
+
else if (typeof hooks.response !== "object" || hooks.response.type || hooks.response.$ref || hooks.response["~standard"])
|
|
466
|
+
hooks.response = {
|
|
467
|
+
200: hooks.response
|
|
468
|
+
};
|
|
465
469
|
if (!hooks.response[status])
|
|
466
|
-
|
|
470
|
+
try {
|
|
471
|
+
hooks.response[status] = schema;
|
|
472
|
+
} catch (error) {
|
|
473
|
+
console.log(
|
|
474
|
+
"[@elysiajs/openapi/gen] Failed to assigned response schema"
|
|
475
|
+
);
|
|
476
|
+
console.log(error);
|
|
477
|
+
}
|
|
467
478
|
}
|
|
468
479
|
}
|
|
469
480
|
}
|
|
@@ -610,7 +621,8 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
610
621
|
}
|
|
611
622
|
if (hooks.response) {
|
|
612
623
|
operation.responses = {};
|
|
613
|
-
if (typeof hooks.response === "object" &&
|
|
624
|
+
if (typeof hooks.response === "object" && // TypeBox
|
|
625
|
+
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
614
626
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
615
627
|
const response = unwrapSchema(schema, vendors);
|
|
616
628
|
if (!response) continue;
|
package/dist/cjs/openapi.js
CHANGED
|
@@ -205,8 +205,19 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
205
205
|
))
|
|
206
206
|
if (isValidSchema(schema)) {
|
|
207
207
|
if (!hooks.response) hooks.response = {};
|
|
208
|
+
else if (typeof hooks.response !== "object" || hooks.response.type || hooks.response.$ref || hooks.response["~standard"])
|
|
209
|
+
hooks.response = {
|
|
210
|
+
200: hooks.response
|
|
211
|
+
};
|
|
208
212
|
if (!hooks.response[status])
|
|
209
|
-
|
|
213
|
+
try {
|
|
214
|
+
hooks.response[status] = schema;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
console.log(
|
|
217
|
+
"[@elysiajs/openapi/gen] Failed to assigned response schema"
|
|
218
|
+
);
|
|
219
|
+
console.log(error);
|
|
220
|
+
}
|
|
210
221
|
}
|
|
211
222
|
}
|
|
212
223
|
}
|
|
@@ -353,7 +364,8 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
353
364
|
}
|
|
354
365
|
if (hooks.response) {
|
|
355
366
|
operation.responses = {};
|
|
356
|
-
if (typeof hooks.response === "object" &&
|
|
367
|
+
if (typeof hooks.response === "object" && // TypeBox
|
|
368
|
+
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
357
369
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
358
370
|
const response = unwrapSchema(schema, vendors);
|
|
359
371
|
if (!response) continue;
|
package/dist/gen/index.mjs
CHANGED
|
@@ -8454,7 +8454,7 @@ var fromTypes = (targetFilePath, {
|
|
|
8454
8454
|
);
|
|
8455
8455
|
const routes = {};
|
|
8456
8456
|
for (const route of extractRootObjects(routesString)) {
|
|
8457
|
-
let schema = TypeBox(route);
|
|
8457
|
+
let schema = TypeBox(route.replaceAll(/readonly/g, ""));
|
|
8458
8458
|
if (schema.type !== "object") continue;
|
|
8459
8459
|
const paths = [];
|
|
8460
8460
|
while (true) {
|
package/dist/index.mjs
CHANGED
|
@@ -435,8 +435,19 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
435
435
|
))
|
|
436
436
|
if (isValidSchema(schema)) {
|
|
437
437
|
if (!hooks.response) hooks.response = {};
|
|
438
|
+
else if (typeof hooks.response !== "object" || hooks.response.type || hooks.response.$ref || hooks.response["~standard"])
|
|
439
|
+
hooks.response = {
|
|
440
|
+
200: hooks.response
|
|
441
|
+
};
|
|
438
442
|
if (!hooks.response[status])
|
|
439
|
-
|
|
443
|
+
try {
|
|
444
|
+
hooks.response[status] = schema;
|
|
445
|
+
} catch (error) {
|
|
446
|
+
console.log(
|
|
447
|
+
"[@elysiajs/openapi/gen] Failed to assigned response schema"
|
|
448
|
+
);
|
|
449
|
+
console.log(error);
|
|
450
|
+
}
|
|
440
451
|
}
|
|
441
452
|
}
|
|
442
453
|
}
|
|
@@ -583,7 +594,8 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
583
594
|
}
|
|
584
595
|
if (hooks.response) {
|
|
585
596
|
operation.responses = {};
|
|
586
|
-
if (typeof hooks.response === "object" &&
|
|
597
|
+
if (typeof hooks.response === "object" && // TypeBox
|
|
598
|
+
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
587
599
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
588
600
|
const response = unwrapSchema(schema, vendors);
|
|
589
601
|
if (!response) continue;
|
package/dist/openapi.mjs
CHANGED
|
@@ -176,8 +176,19 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
176
176
|
))
|
|
177
177
|
if (isValidSchema(schema)) {
|
|
178
178
|
if (!hooks.response) hooks.response = {};
|
|
179
|
+
else if (typeof hooks.response !== "object" || hooks.response.type || hooks.response.$ref || hooks.response["~standard"])
|
|
180
|
+
hooks.response = {
|
|
181
|
+
200: hooks.response
|
|
182
|
+
};
|
|
179
183
|
if (!hooks.response[status])
|
|
180
|
-
|
|
184
|
+
try {
|
|
185
|
+
hooks.response[status] = schema;
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.log(
|
|
188
|
+
"[@elysiajs/openapi/gen] Failed to assigned response schema"
|
|
189
|
+
);
|
|
190
|
+
console.log(error);
|
|
191
|
+
}
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
}
|
|
@@ -324,7 +335,8 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
324
335
|
}
|
|
325
336
|
if (hooks.response) {
|
|
326
337
|
operation.responses = {};
|
|
327
|
-
if (typeof hooks.response === "object" &&
|
|
338
|
+
if (typeof hooks.response === "object" && // TypeBox
|
|
339
|
+
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
328
340
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
329
341
|
const response = unwrapSchema(schema, vendors);
|
|
330
342
|
if (!response) continue;
|