zod-openapi 5.0.0-beta.12 → 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.d.mts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{components-Ci95nsUp.d.ts → components-Ck7iRc2n.d.mts} +17 -3
- package/dist/{components-GWr6bv6y.mjs → components-CtyiAwVj.mjs} +35 -16
- package/dist/{components-VJHAKH5Q.d.mts → components-DLKlRo1M.d.ts} +17 -3
- package/dist/{components-DPGXI3C3.js → components-DNTDGqgA.js} +35 -16
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-
|
|
1
|
+
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-Ck7iRc2n.mjs";
|
|
2
2
|
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
3
|
import { core } from "zod/v4";
|
|
4
4
|
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-
|
|
1
|
+
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-DLKlRo1M.js";
|
|
2
2
|
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
3
|
import { core } from "zod/v4";
|
|
4
4
|
|
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 };
|
|
@@ -481,6 +481,15 @@ interface CreateDocumentOptions {
|
|
|
481
481
|
declare const createDocument: (zodOpenApiObject: ZodOpenApiObject, opts?: CreateDocumentOptions) => OpenAPIObject;
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/create/components.d.ts
|
|
484
|
+
type SchemaSource = {
|
|
485
|
+
type: 'mediaType' | 'header';
|
|
486
|
+
} | {
|
|
487
|
+
type: 'parameter';
|
|
488
|
+
location: {
|
|
489
|
+
in: string;
|
|
490
|
+
name: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
484
493
|
interface ComponentRegistry {
|
|
485
494
|
components: {
|
|
486
495
|
schemas: {
|
|
@@ -488,12 +497,16 @@ interface ComponentRegistry {
|
|
|
488
497
|
input: Map<string, {
|
|
489
498
|
zodType: $ZodType;
|
|
490
499
|
schemaObject: SchemaObject | ReferenceObject;
|
|
491
|
-
|
|
500
|
+
source: SchemaSource & {
|
|
501
|
+
path: string[];
|
|
502
|
+
};
|
|
492
503
|
}>;
|
|
493
504
|
output: Map<string, {
|
|
494
505
|
zodType: $ZodType;
|
|
495
506
|
schemaObject: SchemaObject | ReferenceObject;
|
|
496
|
-
|
|
507
|
+
source: SchemaSource & {
|
|
508
|
+
path: string[];
|
|
509
|
+
};
|
|
497
510
|
}>;
|
|
498
511
|
ids: Map<string, SchemaObject | ReferenceObject>;
|
|
499
512
|
manual: Map<string, {
|
|
@@ -533,8 +546,9 @@ interface ComponentRegistry {
|
|
|
533
546
|
seen: WeakMap<ZodOpenApiPathItemObject, PathItemObject | ReferenceObject>;
|
|
534
547
|
};
|
|
535
548
|
};
|
|
536
|
-
addSchema: (schema: $ZodType, path: string[], opts
|
|
549
|
+
addSchema: (schema: $ZodType, path: string[], opts: {
|
|
537
550
|
io: 'input' | 'output';
|
|
551
|
+
source: SchemaSource;
|
|
538
552
|
}) => SchemaObject | ReferenceObject;
|
|
539
553
|
addHeader: (header: $ZodType, path: string[], opts?: {
|
|
540
554
|
manualId?: string;
|
|
@@ -8,7 +8,10 @@ const isAnyZodType = (schema) => typeof schema === "object" && schema !== null &
|
|
|
8
8
|
//#region src/create/content.ts
|
|
9
9
|
const createMediaTypeObject = (mediaTypeObject, ctx, path) => {
|
|
10
10
|
if (isAnyZodType(mediaTypeObject.schema)) {
|
|
11
|
-
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
11
|
+
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
12
|
+
io: ctx.io,
|
|
13
|
+
source: { type: "mediaType" }
|
|
14
|
+
});
|
|
12
15
|
return {
|
|
13
16
|
...mediaTypeObject,
|
|
14
17
|
schema: schemaObject
|
|
@@ -447,12 +450,14 @@ const createRegistry = (components) => {
|
|
|
447
450
|
}
|
|
448
451
|
},
|
|
449
452
|
addSchema: (schema, path, opts) => {
|
|
450
|
-
const io = opts?.io ?? "output";
|
|
451
453
|
const schemaObject = {};
|
|
452
|
-
registry$1.components.schemas[io].set(path.join(" > "), {
|
|
454
|
+
registry$1.components.schemas[opts.io].set(path.join(" > "), {
|
|
453
455
|
schemaObject,
|
|
454
456
|
zodType: schema,
|
|
455
|
-
|
|
457
|
+
source: {
|
|
458
|
+
path,
|
|
459
|
+
...opts?.source
|
|
460
|
+
}
|
|
456
461
|
});
|
|
457
462
|
return schemaObject;
|
|
458
463
|
},
|
|
@@ -463,7 +468,21 @@ const createRegistry = (components) => {
|
|
|
463
468
|
const name = opts?.location?.name ?? meta?.param?.name;
|
|
464
469
|
const inLocation = opts?.location?.in ?? meta?.param?.in;
|
|
465
470
|
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
466
|
-
const schemaObject = registry$1.addSchema(parameter, [
|
|
471
|
+
const schemaObject = registry$1.addSchema(parameter, [
|
|
472
|
+
...path,
|
|
473
|
+
inLocation,
|
|
474
|
+
name,
|
|
475
|
+
"schema"
|
|
476
|
+
], {
|
|
477
|
+
io: "input",
|
|
478
|
+
source: {
|
|
479
|
+
type: "parameter",
|
|
480
|
+
location: {
|
|
481
|
+
in: inLocation,
|
|
482
|
+
name
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
});
|
|
467
486
|
const { id: metaId,...rest } = meta?.param ?? {};
|
|
468
487
|
const parameterObject = {
|
|
469
488
|
...rest,
|
|
@@ -475,7 +494,7 @@ const createRegistry = (components) => {
|
|
|
475
494
|
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
476
495
|
const id = metaId ?? opts?.manualId;
|
|
477
496
|
if (id) {
|
|
478
|
-
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
497
|
+
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
479
498
|
const ref = { $ref: `#/components/parameters/${id}` };
|
|
480
499
|
registry$1.components.parameters.seen.set(parameter, ref);
|
|
481
500
|
registry$1.components.parameters.ids.set(id, parameterObject);
|
|
@@ -493,9 +512,12 @@ const createRegistry = (components) => {
|
|
|
493
512
|
const headerObject = rest;
|
|
494
513
|
if (isRequired(header, "output")) headerObject.required = true;
|
|
495
514
|
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
496
|
-
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
515
|
+
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
516
|
+
io: "output",
|
|
517
|
+
source: { type: "header" }
|
|
518
|
+
});
|
|
497
519
|
if (id) {
|
|
498
|
-
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`);
|
|
499
521
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
500
522
|
registry$1.components.headers.ids.set(id, headerObject);
|
|
501
523
|
registry$1.components.headers.seen.set(header, ref);
|
|
@@ -517,7 +539,7 @@ const createRegistry = (components) => {
|
|
|
517
539
|
};
|
|
518
540
|
const id = metaId ?? opts?.manualId;
|
|
519
541
|
if (id) {
|
|
520
|
-
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`);
|
|
521
543
|
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
522
544
|
registry$1.components.requestBodies.ids.set(id, requestBodyObject);
|
|
523
545
|
registry$1.components.requestBodies.seen.set(requestBody, ref);
|
|
@@ -548,7 +570,7 @@ const createRegistry = (components) => {
|
|
|
548
570
|
pathItemObject[key] = value;
|
|
549
571
|
}
|
|
550
572
|
if (id) {
|
|
551
|
-
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`);
|
|
552
574
|
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
553
575
|
registry$1.components.pathItems.ids.set(id, pathItemObject);
|
|
554
576
|
registry$1.components.pathItems.seen.set(pathItem, ref);
|
|
@@ -570,7 +592,7 @@ const createRegistry = (components) => {
|
|
|
570
592
|
}, [...path, "content"]);
|
|
571
593
|
const id = metaId ?? opts?.manualId;
|
|
572
594
|
if (id) {
|
|
573
|
-
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`);
|
|
574
596
|
const ref = { $ref: `#/components/responses/${id}` };
|
|
575
597
|
registry$1.components.responses.ids.set(id, responseObject);
|
|
576
598
|
registry$1.components.responses.seen.set(response, ref);
|
|
@@ -593,7 +615,7 @@ const createRegistry = (components) => {
|
|
|
593
615
|
}
|
|
594
616
|
const id = metaId ?? opts?.manualId;
|
|
595
617
|
if (id) {
|
|
596
|
-
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`);
|
|
597
619
|
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
598
620
|
registry$1.components.callbacks.ids.set(id, callbackObject);
|
|
599
621
|
registry$1.components.callbacks.seen.set(callback, ref);
|
|
@@ -701,10 +723,7 @@ const registerPathItems = (pathItems, registry$1) => {
|
|
|
701
723
|
};
|
|
702
724
|
const createIOSchemas = (ctx) => {
|
|
703
725
|
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.components.schemas[ctx.io]), ctx);
|
|
704
|
-
for (const [key, schema] of Object.entries(components))
|
|
705
|
-
if (ctx.registry.components.schemas.ids.has(key)) throw new Error(`Schema "${key}" is already registered`);
|
|
706
|
-
ctx.registry.components.schemas.ids.set(key, schema);
|
|
707
|
-
}
|
|
726
|
+
for (const [key, schema] of Object.entries(components)) ctx.registry.components.schemas.ids.set(key, schema);
|
|
708
727
|
for (const [key, schema] of Object.entries(schemas)) {
|
|
709
728
|
const ioSchema = ctx.registry.components.schemas[ctx.io].get(key);
|
|
710
729
|
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
|
@@ -481,6 +481,15 @@ interface CreateDocumentOptions {
|
|
|
481
481
|
declare const createDocument: (zodOpenApiObject: ZodOpenApiObject, opts?: CreateDocumentOptions) => OpenAPIObject;
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/create/components.d.ts
|
|
484
|
+
type SchemaSource = {
|
|
485
|
+
type: 'mediaType' | 'header';
|
|
486
|
+
} | {
|
|
487
|
+
type: 'parameter';
|
|
488
|
+
location: {
|
|
489
|
+
in: string;
|
|
490
|
+
name: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
484
493
|
interface ComponentRegistry {
|
|
485
494
|
components: {
|
|
486
495
|
schemas: {
|
|
@@ -488,12 +497,16 @@ interface ComponentRegistry {
|
|
|
488
497
|
input: Map<string, {
|
|
489
498
|
zodType: $ZodType;
|
|
490
499
|
schemaObject: SchemaObject | ReferenceObject;
|
|
491
|
-
|
|
500
|
+
source: SchemaSource & {
|
|
501
|
+
path: string[];
|
|
502
|
+
};
|
|
492
503
|
}>;
|
|
493
504
|
output: Map<string, {
|
|
494
505
|
zodType: $ZodType;
|
|
495
506
|
schemaObject: SchemaObject | ReferenceObject;
|
|
496
|
-
|
|
507
|
+
source: SchemaSource & {
|
|
508
|
+
path: string[];
|
|
509
|
+
};
|
|
497
510
|
}>;
|
|
498
511
|
ids: Map<string, SchemaObject | ReferenceObject>;
|
|
499
512
|
manual: Map<string, {
|
|
@@ -533,8 +546,9 @@ interface ComponentRegistry {
|
|
|
533
546
|
seen: WeakMap<ZodOpenApiPathItemObject, PathItemObject | ReferenceObject>;
|
|
534
547
|
};
|
|
535
548
|
};
|
|
536
|
-
addSchema: (schema: $ZodType, path: string[], opts
|
|
549
|
+
addSchema: (schema: $ZodType, path: string[], opts: {
|
|
537
550
|
io: 'input' | 'output';
|
|
551
|
+
source: SchemaSource;
|
|
538
552
|
}) => SchemaObject | ReferenceObject;
|
|
539
553
|
addHeader: (header: $ZodType, path: string[], opts?: {
|
|
540
554
|
manualId?: string;
|
|
@@ -31,7 +31,10 @@ const isAnyZodType = (schema) => typeof schema === "object" && schema !== null &
|
|
|
31
31
|
//#region src/create/content.ts
|
|
32
32
|
const createMediaTypeObject = (mediaTypeObject, ctx, path) => {
|
|
33
33
|
if (isAnyZodType(mediaTypeObject.schema)) {
|
|
34
|
-
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
34
|
+
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
35
|
+
io: ctx.io,
|
|
36
|
+
source: { type: "mediaType" }
|
|
37
|
+
});
|
|
35
38
|
return {
|
|
36
39
|
...mediaTypeObject,
|
|
37
40
|
schema: schemaObject
|
|
@@ -470,12 +473,14 @@ const createRegistry = (components) => {
|
|
|
470
473
|
}
|
|
471
474
|
},
|
|
472
475
|
addSchema: (schema, path, opts) => {
|
|
473
|
-
const io = opts?.io ?? "output";
|
|
474
476
|
const schemaObject = {};
|
|
475
|
-
registry$1.components.schemas[io].set(path.join(" > "), {
|
|
477
|
+
registry$1.components.schemas[opts.io].set(path.join(" > "), {
|
|
476
478
|
schemaObject,
|
|
477
479
|
zodType: schema,
|
|
478
|
-
|
|
480
|
+
source: {
|
|
481
|
+
path,
|
|
482
|
+
...opts?.source
|
|
483
|
+
}
|
|
479
484
|
});
|
|
480
485
|
return schemaObject;
|
|
481
486
|
},
|
|
@@ -486,7 +491,21 @@ const createRegistry = (components) => {
|
|
|
486
491
|
const name = opts?.location?.name ?? meta?.param?.name;
|
|
487
492
|
const inLocation = opts?.location?.in ?? meta?.param?.in;
|
|
488
493
|
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
489
|
-
const schemaObject = registry$1.addSchema(parameter, [
|
|
494
|
+
const schemaObject = registry$1.addSchema(parameter, [
|
|
495
|
+
...path,
|
|
496
|
+
inLocation,
|
|
497
|
+
name,
|
|
498
|
+
"schema"
|
|
499
|
+
], {
|
|
500
|
+
io: "input",
|
|
501
|
+
source: {
|
|
502
|
+
type: "parameter",
|
|
503
|
+
location: {
|
|
504
|
+
in: inLocation,
|
|
505
|
+
name
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
490
509
|
const { id: metaId,...rest } = meta?.param ?? {};
|
|
491
510
|
const parameterObject = {
|
|
492
511
|
...rest,
|
|
@@ -498,7 +517,7 @@ const createRegistry = (components) => {
|
|
|
498
517
|
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
499
518
|
const id = metaId ?? opts?.manualId;
|
|
500
519
|
if (id) {
|
|
501
|
-
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
520
|
+
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
502
521
|
const ref = { $ref: `#/components/parameters/${id}` };
|
|
503
522
|
registry$1.components.parameters.seen.set(parameter, ref);
|
|
504
523
|
registry$1.components.parameters.ids.set(id, parameterObject);
|
|
@@ -516,9 +535,12 @@ const createRegistry = (components) => {
|
|
|
516
535
|
const headerObject = rest;
|
|
517
536
|
if (isRequired(header, "output")) headerObject.required = true;
|
|
518
537
|
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
519
|
-
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
538
|
+
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
539
|
+
io: "output",
|
|
540
|
+
source: { type: "header" }
|
|
541
|
+
});
|
|
520
542
|
if (id) {
|
|
521
|
-
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`);
|
|
522
544
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
523
545
|
registry$1.components.headers.ids.set(id, headerObject);
|
|
524
546
|
registry$1.components.headers.seen.set(header, ref);
|
|
@@ -540,7 +562,7 @@ const createRegistry = (components) => {
|
|
|
540
562
|
};
|
|
541
563
|
const id = metaId ?? opts?.manualId;
|
|
542
564
|
if (id) {
|
|
543
|
-
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`);
|
|
544
566
|
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
545
567
|
registry$1.components.requestBodies.ids.set(id, requestBodyObject);
|
|
546
568
|
registry$1.components.requestBodies.seen.set(requestBody, ref);
|
|
@@ -571,7 +593,7 @@ const createRegistry = (components) => {
|
|
|
571
593
|
pathItemObject[key] = value;
|
|
572
594
|
}
|
|
573
595
|
if (id) {
|
|
574
|
-
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`);
|
|
575
597
|
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
576
598
|
registry$1.components.pathItems.ids.set(id, pathItemObject);
|
|
577
599
|
registry$1.components.pathItems.seen.set(pathItem, ref);
|
|
@@ -593,7 +615,7 @@ const createRegistry = (components) => {
|
|
|
593
615
|
}, [...path, "content"]);
|
|
594
616
|
const id = metaId ?? opts?.manualId;
|
|
595
617
|
if (id) {
|
|
596
|
-
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`);
|
|
597
619
|
const ref = { $ref: `#/components/responses/${id}` };
|
|
598
620
|
registry$1.components.responses.ids.set(id, responseObject);
|
|
599
621
|
registry$1.components.responses.seen.set(response, ref);
|
|
@@ -616,7 +638,7 @@ const createRegistry = (components) => {
|
|
|
616
638
|
}
|
|
617
639
|
const id = metaId ?? opts?.manualId;
|
|
618
640
|
if (id) {
|
|
619
|
-
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`);
|
|
620
642
|
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
621
643
|
registry$1.components.callbacks.ids.set(id, callbackObject);
|
|
622
644
|
registry$1.components.callbacks.seen.set(callback, ref);
|
|
@@ -724,10 +746,7 @@ const registerPathItems = (pathItems, registry$1) => {
|
|
|
724
746
|
};
|
|
725
747
|
const createIOSchemas = (ctx) => {
|
|
726
748
|
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.components.schemas[ctx.io]), ctx);
|
|
727
|
-
for (const [key, schema] of Object.entries(components))
|
|
728
|
-
if (ctx.registry.components.schemas.ids.has(key)) throw new Error(`Schema "${key}" is already registered`);
|
|
729
|
-
ctx.registry.components.schemas.ids.set(key, schema);
|
|
730
|
-
}
|
|
749
|
+
for (const [key, schema] of Object.entries(components)) ctx.registry.components.schemas.ids.set(key, schema);
|
|
731
750
|
for (const [key, schema] of Object.entries(schemas)) {
|
|
732
751
|
const ioSchema = ctx.registry.components.schemas[ctx.io].get(key);
|
|
733
752
|
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-Ck7iRc2n.mjs";
|
|
2
2
|
import { core } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-DLKlRo1M.js";
|
|
2
2
|
import { core } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
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 = {}) => {
|