-
Notifications
You must be signed in to change notification settings - Fork 0
/
deps.ts
115 lines (106 loc) · 2.5 KB
/
deps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
export { join } from "jsr:@std/path@^1.0.8";
export { Router, Status } from "jsr:@oak/oak@^17.1.3";
export type {
Application,
Context,
ErrorStatus,
Next,
RouteContext,
} from "jsr:@oak/oak@^17.1.3";
import {
extendZodWithOpenApi,
type ResponseConfig,
type RouteConfig,
} from "npm:@asteasolutions/zod-to-openapi@^7.2.0";
export type OakOpenApiSpec =
& Omit<RouteConfig, "method" | "path" | "responses">
& {
responses?: {
[statusCode: string]: ResponseConfig;
};
};
export { type ResponseConfig, type RouteConfig };
export {
OpenApiGeneratorV3,
OpenAPIRegistry,
type ZodRequestBody,
} from "npm:@asteasolutions/zod-to-openapi@^7.2.0";
export { type OpenAPIObjectConfig } from "npm:@asteasolutions/zod-to-openapi@^7.2.0/dist/v3.0/openapi-generator";
// must import from `npm:` instead of from `deno.land` to be compatible with `@asteasolutions/zod-to-openapi`
import { z as slowTypedZ } from "npm:zod@^3.23.8";
extendZodWithOpenApi(slowTypedZ);
type SubsetOfZ = Pick<
typeof slowTypedZ,
| "object"
| "array"
| "string"
| "number"
| "boolean"
| "void"
| "undefined"
| "null"
| "enum"
| "addIssueToContext"
| "any"
| "bigint"
| "coerce"
| "custom"
| "date"
| "datetimeRegex"
| "defaultErrorMap"
| "discriminatedUnion"
| "effect"
| "function"
| "getErrorMap"
| "getParsedType"
| "instanceof"
| "intersection"
| "isAborted"
| "isAsync"
| "isDirty"
| "isValid"
| "late"
| "lazy"
| "literal"
| "makeIssue"
| "map"
| "objectUtil"
| "oboolean"
| "onumber"
| "optional"
| "ostring"
| "pipeline"
| "preprocess"
| "promise"
| "quotelessJson"
| "record"
| "set"
| "setErrorMap"
| "strictObject"
| "symbol"
| "transformer"
| "tuple"
| "union"
| "unknown"
| "util"
| "ZodError"
>;
/**
* entry to the `Zod` API, enhanced with `@asteasolutions/zod-to-openapi`;
* for usage documentation please refer to https://github.com/asteasolutions/zod-to-openapi?tab=readme-ov-file#purpose-and-quick-example
* @example
* ```ts
* const SomeZodSchema = z.object({ name: z.string() });
* ```
*/
export const z: SubsetOfZ = slowTypedZ;
/**
* re-exported `z.infer` type inference API;
* for usage documentation please refer to https://github.com/colinhacks/zod?tab=readme-ov-file#type-inference
* @example
* ```ts
* const SomeZodSchema = z.object({ name: z.string() });
* const somePathParam: zInfer<typeof SomeZodSchema> = { name: "foo" };
* ```
*/
export type zInfer<T extends slowTypedZ.ZodType> = slowTypedZ.infer<T>;