zod-openapi 2.15.0 → 2.15.2

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.
@@ -11,7 +11,7 @@ interface AdditionalPropertyOptions {
11
11
  export declare const createObjectSchemaFromShape: (shape: ZodRawShape, { unknownKeys, catchAll }: AdditionalPropertyOptions, state: SchemaState) => Schema;
12
12
  export declare const mapRequired: (shape: ZodRawShape, state: SchemaState) => {
13
13
  required: string[];
14
- effects?: Effect[] | undefined;
14
+ effects?: Effect[];
15
15
  } | undefined;
16
16
  interface PropertyMap {
17
17
  properties: NonNullable<oas31.SchemaObject['properties']>;
@@ -1,4 +1,4 @@
1
- import type { UnknownKeysParam, ZodDate, ZodObject, ZodRawShape, ZodTypeAny, z } from 'zod';
1
+ import type { ZodDate, ZodObject, ZodTypeAny, z } from 'zod';
2
2
  import type { CreationType } from './create/components';
3
3
  import type { oas30, oas31 } from './openapi3-ts/dist';
4
4
  type SchemaObject = oas30.SchemaObject & oas31.SchemaObject;
@@ -56,7 +56,7 @@ interface ZodOpenApiExtendMetadata {
56
56
  extends: ZodObject<any, any, any, any, any>;
57
57
  }
58
58
  declare module 'zod' {
59
- interface ZodType<Output, Def extends ZodTypeDef, Input = Output> {
59
+ interface ZodType {
60
60
  /**
61
61
  * Add OpenAPI metadata to a Zod Type
62
62
  */
@@ -68,7 +68,7 @@ declare module 'zod' {
68
68
  */
69
69
  openapi?: ZodOpenApiMetadata<ZodTypeAny>;
70
70
  }
71
- interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
71
+ interface ZodObjectDef {
72
72
  extendMetadata?: ZodOpenApiExtendMetadata;
73
73
  }
74
74
  }
@@ -1,42 +1,42 @@
1
- import type { ArrayCardinality, EnumLike, UnknownKeysParam, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodDiscriminatedUnionOption, ZodEffects, ZodEnum, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodTypeDef, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, objectInputType, objectOutputType } from 'zod';
2
- type ZodTypeMap<T extends ZodTypeAny, U extends ZodTypeAny, V, W extends ZodRawShape, B extends string | number | symbol, Discriminator extends string, Options extends Array<ZodDiscriminatedUnionOption<Discriminator>>, Enum extends [string, ...string[]], Returns extends ZodTypeAny, Args extends ZodTuple, ELike extends EnumLike, Union extends readonly [ZodTypeAny, ...ZodTypeAny[]], UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<W, Catchall, UnknownKeys>, Input = objectInputType<W, Catchall, UnknownKeys>, Cardinality extends ArrayCardinality = 'many'> = {
1
+ import type { EnumLike, UnknownKeysParam, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodTypeDef, ZodUndefined, ZodUnion, ZodUnionOptions, ZodUnknown, ZodVoid } from 'zod';
2
+ type ZodTypeMap = {
3
3
  ZodAny: ZodAny;
4
- ZodArray: ZodArray<T, Cardinality>;
4
+ ZodArray: ZodArray<ZodTypeAny>;
5
5
  ZodBigInt: ZodBigInt;
6
6
  ZodBoolean: ZodBoolean;
7
- ZodBranded: ZodBranded<T, B>;
8
- ZodCatch: ZodCatch<T>;
7
+ ZodBranded: ZodBranded<ZodTypeAny, string | number | symbol>;
8
+ ZodCatch: ZodCatch<ZodTypeAny>;
9
9
  ZodDate: ZodDate;
10
- ZodDefault: ZodDefault<T>;
11
- ZodDiscriminatedUnion: ZodDiscriminatedUnion<Discriminator, Options>;
12
- ZodEffects: ZodEffects<T>;
13
- ZodEnum: ZodEnum<Enum>;
14
- ZodFunction: ZodFunction<Args, Returns>;
15
- ZodIntersection: ZodIntersection<T, U>;
16
- ZodLazy: ZodLazy<T>;
17
- ZodLiteral: ZodLiteral<V>;
10
+ ZodDefault: ZodDefault<ZodTypeAny>;
11
+ ZodDiscriminatedUnion: ZodDiscriminatedUnion<string, any>;
12
+ ZodEffects: ZodEffects<ZodTypeAny>;
13
+ ZodEnum: ZodEnum<[string, ...string[]]>;
14
+ ZodFunction: ZodFunction<ZodTuple<any, any>, ZodTypeAny>;
15
+ ZodIntersection: ZodIntersection<ZodTypeAny, ZodTypeAny>;
16
+ ZodLazy: ZodLazy<ZodTypeAny>;
17
+ ZodLiteral: ZodLiteral<ZodTypeAny>;
18
18
  ZodMap: ZodMap;
19
19
  ZodNaN: ZodNaN;
20
- ZodNativeEnum: ZodNativeEnum<ELike>;
20
+ ZodNativeEnum: ZodNativeEnum<EnumLike>;
21
21
  ZodNever: ZodNever;
22
22
  ZodNull: ZodNull;
23
- ZodNullable: ZodNullable<T>;
23
+ ZodNullable: ZodNullable<ZodTypeAny>;
24
24
  ZodNumber: ZodNumber;
25
- ZodObject: ZodObject<W, UnknownKeys, Catchall, Output, Input>;
26
- ZodOptional: ZodOptional<T>;
27
- ZodPipeline: ZodPipeline<T, U>;
28
- ZodPromise: ZodPromise<T>;
29
- ZodReadonly: ZodReadonly<T>;
25
+ ZodObject: ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
26
+ ZodOptional: ZodOptional<ZodTypeAny>;
27
+ ZodPipeline: ZodPipeline<ZodTypeAny, ZodTypeAny>;
28
+ ZodPromise: ZodPromise<ZodTypeAny>;
29
+ ZodReadonly: ZodReadonly<ZodTypeAny>;
30
30
  ZodRecord: ZodRecord;
31
31
  ZodSet: ZodSet;
32
32
  ZodString: ZodString;
33
33
  ZodSymbol: ZodSymbol;
34
34
  ZodTuple: ZodTuple;
35
35
  ZodUndefined: ZodUndefined;
36
- ZodUnion: ZodUnion<Union>;
36
+ ZodUnion: ZodUnion<ZodUnionOptions>;
37
37
  ZodUnknown: ZodUnknown;
38
38
  ZodVoid: ZodVoid;
39
39
  };
40
- export declare const isZodType: <T extends ZodTypeAny, U extends ZodTypeAny, V, W extends ZodRawShape, B extends string | number | symbol, Discriminator extends string, Options extends ZodDiscriminatedUnionOption<Discriminator>[], Enum extends [string, ...string[]], Returns extends ZodTypeAny, Args extends ZodTuple<[ZodTypeAny, ...ZodTypeAny[]], null>, ELike extends EnumLike, Union extends readonly [ZodTypeAny, ...ZodTypeAny[]], K extends keyof ZodTypeMap<T, U, V, W, B, Discriminator, Options, Enum, Returns, Args, ELike, Union, UnknownKeys, Catchall, Output, Input, Cardinality>, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<W, Catchall, UnknownKeys>, Input = objectInputType<W, Catchall, UnknownKeys>, Cardinality extends ArrayCardinality = "many">(zodType: unknown, typeName: K) => zodType is ZodTypeMap<T, U, V, W, B, Discriminator, Options, Enum, Returns, Args, ELike, Union, UnknownKeys, Catchall, Output, Input, Cardinality>[K];
40
+ export declare const isZodType: <K extends keyof ZodTypeMap>(zodType: unknown, typeName: K) => zodType is ZodTypeMap[K];
41
41
  export declare const isAnyZodType: (zodType: unknown) => zodType is ZodType<any, ZodTypeDef, any>;
42
42
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,11 +48,11 @@
48
48
  "test:watch": "skuba test --watch"
49
49
  },
50
50
  "devDependencies": {
51
- "@redocly/cli": "1.10.5",
51
+ "@redocly/cli": "1.11.0",
52
52
  "@types/node": "^20.3.0",
53
53
  "eslint-plugin-zod-openapi": "^0.1.0",
54
54
  "openapi3-ts": "4.3.1",
55
- "skuba": "7.5.1",
55
+ "skuba": "8.0.0",
56
56
  "yaml": "2.4.1",
57
57
  "zod": "3.22.4"
58
58
  },