zod-openapi 5.0.0-beta.13 → 5.0.0-beta.14
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/api.js
CHANGED
package/dist/api.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-
|
|
1
|
+
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-CtyiAwVj.mjs";
|
|
2
2
|
|
|
3
3
|
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
|
@@ -517,7 +517,7 @@ const createRegistry = (components) => {
|
|
|
517
517
|
source: { type: "header" }
|
|
518
518
|
});
|
|
519
519
|
if (id) {
|
|
520
|
-
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
520
|
+
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
521
521
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
522
522
|
registry$1.components.headers.ids.set(id, headerObject);
|
|
523
523
|
registry$1.components.headers.seen.set(header, ref);
|
|
@@ -539,7 +539,7 @@ const createRegistry = (components) => {
|
|
|
539
539
|
};
|
|
540
540
|
const id = metaId ?? opts?.manualId;
|
|
541
541
|
if (id) {
|
|
542
|
-
if (registry$1.components.requestBodies.ids.has(id)) throw new Error(`RequestBody "${id}" is already registered`);
|
|
542
|
+
if (registry$1.components.requestBodies.ids.has(id)) throw new Error(`RequestBody "${id}" at ${path.join(" > ")} is already registered`);
|
|
543
543
|
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
544
544
|
registry$1.components.requestBodies.ids.set(id, requestBodyObject);
|
|
545
545
|
registry$1.components.requestBodies.seen.set(requestBody, ref);
|
|
@@ -570,7 +570,7 @@ const createRegistry = (components) => {
|
|
|
570
570
|
pathItemObject[key] = value;
|
|
571
571
|
}
|
|
572
572
|
if (id) {
|
|
573
|
-
if (registry$1.components.pathItems.ids.has(id)) throw new Error(`PathItem "${id}" is already registered`);
|
|
573
|
+
if (registry$1.components.pathItems.ids.has(id)) throw new Error(`PathItem "${id}" at ${path.join(" > ")} is already registered`);
|
|
574
574
|
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
575
575
|
registry$1.components.pathItems.ids.set(id, pathItemObject);
|
|
576
576
|
registry$1.components.pathItems.seen.set(pathItem, ref);
|
|
@@ -592,7 +592,7 @@ const createRegistry = (components) => {
|
|
|
592
592
|
}, [...path, "content"]);
|
|
593
593
|
const id = metaId ?? opts?.manualId;
|
|
594
594
|
if (id) {
|
|
595
|
-
if (registry$1.components.responses.ids.has(id)) throw new Error(`Response "${id}" is already registered`);
|
|
595
|
+
if (registry$1.components.responses.ids.has(id)) throw new Error(`Response "${id}" at ${path.join(" > ")} is already registered`);
|
|
596
596
|
const ref = { $ref: `#/components/responses/${id}` };
|
|
597
597
|
registry$1.components.responses.ids.set(id, responseObject);
|
|
598
598
|
registry$1.components.responses.seen.set(response, ref);
|
|
@@ -615,7 +615,7 @@ const createRegistry = (components) => {
|
|
|
615
615
|
}
|
|
616
616
|
const id = metaId ?? opts?.manualId;
|
|
617
617
|
if (id) {
|
|
618
|
-
if (registry$1.components.callbacks.ids.has(id)) throw new Error(`Callback "${id}" is already registered`);
|
|
618
|
+
if (registry$1.components.callbacks.ids.has(id)) throw new Error(`Callback "${id}" at ${path.join(" > ")} is already registered`);
|
|
619
619
|
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
620
620
|
registry$1.components.callbacks.ids.set(id, callbackObject);
|
|
621
621
|
registry$1.components.callbacks.seen.set(callback, ref);
|
|
@@ -723,10 +723,7 @@ const registerPathItems = (pathItems, registry$1) => {
|
|
|
723
723
|
};
|
|
724
724
|
const createIOSchemas = (ctx) => {
|
|
725
725
|
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.components.schemas[ctx.io]), ctx);
|
|
726
|
-
for (const [key, schema] of Object.entries(components))
|
|
727
|
-
if (ctx.registry.components.schemas.ids.has(key)) throw new Error(`Schema "${key}" is already registered`);
|
|
728
|
-
ctx.registry.components.schemas.ids.set(key, schema);
|
|
729
|
-
}
|
|
726
|
+
for (const [key, schema] of Object.entries(components)) ctx.registry.components.schemas.ids.set(key, schema);
|
|
730
727
|
for (const [key, schema] of Object.entries(schemas)) {
|
|
731
728
|
const ioSchema = ctx.registry.components.schemas[ctx.io].get(key);
|
|
732
729
|
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
|
@@ -540,7 +540,7 @@ const createRegistry = (components) => {
|
|
|
540
540
|
source: { type: "header" }
|
|
541
541
|
});
|
|
542
542
|
if (id) {
|
|
543
|
-
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
543
|
+
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
544
544
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
545
545
|
registry$1.components.headers.ids.set(id, headerObject);
|
|
546
546
|
registry$1.components.headers.seen.set(header, ref);
|
|
@@ -562,7 +562,7 @@ const createRegistry = (components) => {
|
|
|
562
562
|
};
|
|
563
563
|
const id = metaId ?? opts?.manualId;
|
|
564
564
|
if (id) {
|
|
565
|
-
if (registry$1.components.requestBodies.ids.has(id)) throw new Error(`RequestBody "${id}" is already registered`);
|
|
565
|
+
if (registry$1.components.requestBodies.ids.has(id)) throw new Error(`RequestBody "${id}" at ${path.join(" > ")} is already registered`);
|
|
566
566
|
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
567
567
|
registry$1.components.requestBodies.ids.set(id, requestBodyObject);
|
|
568
568
|
registry$1.components.requestBodies.seen.set(requestBody, ref);
|
|
@@ -593,7 +593,7 @@ const createRegistry = (components) => {
|
|
|
593
593
|
pathItemObject[key] = value;
|
|
594
594
|
}
|
|
595
595
|
if (id) {
|
|
596
|
-
if (registry$1.components.pathItems.ids.has(id)) throw new Error(`PathItem "${id}" is already registered`);
|
|
596
|
+
if (registry$1.components.pathItems.ids.has(id)) throw new Error(`PathItem "${id}" at ${path.join(" > ")} is already registered`);
|
|
597
597
|
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
598
598
|
registry$1.components.pathItems.ids.set(id, pathItemObject);
|
|
599
599
|
registry$1.components.pathItems.seen.set(pathItem, ref);
|
|
@@ -615,7 +615,7 @@ const createRegistry = (components) => {
|
|
|
615
615
|
}, [...path, "content"]);
|
|
616
616
|
const id = metaId ?? opts?.manualId;
|
|
617
617
|
if (id) {
|
|
618
|
-
if (registry$1.components.responses.ids.has(id)) throw new Error(`Response "${id}" is already registered`);
|
|
618
|
+
if (registry$1.components.responses.ids.has(id)) throw new Error(`Response "${id}" at ${path.join(" > ")} is already registered`);
|
|
619
619
|
const ref = { $ref: `#/components/responses/${id}` };
|
|
620
620
|
registry$1.components.responses.ids.set(id, responseObject);
|
|
621
621
|
registry$1.components.responses.seen.set(response, ref);
|
|
@@ -638,7 +638,7 @@ const createRegistry = (components) => {
|
|
|
638
638
|
}
|
|
639
639
|
const id = metaId ?? opts?.manualId;
|
|
640
640
|
if (id) {
|
|
641
|
-
if (registry$1.components.callbacks.ids.has(id)) throw new Error(`Callback "${id}" is already registered`);
|
|
641
|
+
if (registry$1.components.callbacks.ids.has(id)) throw new Error(`Callback "${id}" at ${path.join(" > ")} is already registered`);
|
|
642
642
|
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
643
643
|
registry$1.components.callbacks.ids.set(id, callbackObject);
|
|
644
644
|
registry$1.components.callbacks.seen.set(callback, ref);
|
|
@@ -746,10 +746,7 @@ const registerPathItems = (pathItems, registry$1) => {
|
|
|
746
746
|
};
|
|
747
747
|
const createIOSchemas = (ctx) => {
|
|
748
748
|
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.components.schemas[ctx.io]), ctx);
|
|
749
|
-
for (const [key, schema] of Object.entries(components))
|
|
750
|
-
if (ctx.registry.components.schemas.ids.has(key)) throw new Error(`Schema "${key}" is already registered`);
|
|
751
|
-
ctx.registry.components.schemas.ids.set(key, schema);
|
|
752
|
-
}
|
|
749
|
+
for (const [key, schema] of Object.entries(components)) ctx.registry.components.schemas.ids.set(key, schema);
|
|
753
750
|
for (const [key, schema] of Object.entries(schemas)) {
|
|
754
751
|
const ioSchema = ctx.registry.components.schemas[ctx.io].get(key);
|
|
755
752
|
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponents, createPaths, createRegistry, createSchema } from "./components-
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-CtyiAwVj.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/create/document.ts
|
|
4
4
|
const createDocument = (zodOpenApiObject, opts = {}) => {
|