Skip to content

Commit 454fb18

Browse files
committed
fix: ZodType issues
1 parent 76980c0 commit 454fb18

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/core/body.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { resolveContent } from "./content";
44
import { safeParse } from "./zod-error-handler";
55
import type { ExampleObject } from "@omer-x/openapi-types/example";
66
import type { RequestBodyObject } from "@omer-x/openapi-types/request-body";
7-
import type { ZodError, ZodType, ZodTypeDef } from "zod";
7+
import type { ZodError, ZodType } from "zod";
88

99
export function resolveRequestBody<I, O>(
10-
source?: ZodType<O, ZodTypeDef, I> | string,
10+
source?: ZodType<O, I> | string,
1111
isFormData: boolean = false,
1212
customExample?: NoInfer<O>,
1313
customExamples?: Record<string, ExampleObject<NoInfer<O>>>,
@@ -23,7 +23,7 @@ export function resolveRequestBody<I, O>(
2323
export async function parseRequestBody<I, O>(
2424
request: FixedRequest<NoInfer<I>>,
2525
method: HttpMethod,
26-
schema?: ZodType<O, ZodTypeDef, I> | string,
26+
schema?: ZodType<O, I> | string,
2727
isFormData: boolean = false,
2828
): Promise<O | null> {
2929
if (!schema || typeof schema === "string") return null;

src/core/content.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import createMediaType from "./createMediaType";
33
import convertToOpenAPI from "./zod-to-openapi";
44
import type { ExampleObject } from "@omer-x/openapi-types/example";
55
import type { RequestBodyObject } from "@omer-x/openapi-types/request-body";
6-
import type { ZodType, ZodTypeDef } from "zod";
6+
import type { ZodType } from "zod";
77

88
export function resolveContent<I, O>(
9-
source?: ZodType<O, ZodTypeDef, I> | string,
9+
source?: ZodType<O, I> | string,
1010
isArray: boolean = false,
1111
isFormData: boolean = false,
1212
customExample?: NoInfer<O>,

src/core/definer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { addBadRequest, bundleResponses } from "./responses";
99
import parseSearchParams from "./search-params";
1010
import type { ExampleObject } from "@omer-x/openapi-types/example";
1111
import type { OperationObject } from "@omer-x/openapi-types/operation";
12-
import type { ZodIssue, ZodType, ZodTypeDef } from "zod";
12+
import type { ZodIssue, ZodType } from "zod";
1313

1414
type ActionSource<PathParams, QueryParams, RequestBody> = {
1515
pathParams: PathParams,
@@ -27,7 +27,7 @@ type RouteWithoutBody = {
2727

2828
type RouteWithBody<I, O> = {
2929
method: Exclude<HttpMethod, "GET" | "DELETE" | "HEAD">,
30-
requestBody?: ZodType<O, ZodTypeDef, I> | string,
30+
requestBody?: ZodType<O, I> | string,
3131
requestBodyExample?: NoInfer<O>,
3232
requestBodyExamples?: Record<string, ExampleObject<NoInfer<O>>>,
3333
hasFormData?: boolean,
@@ -50,8 +50,8 @@ type RouteOptions<
5050
summary: string,
5151
description: string,
5252
tags: string[],
53-
pathParams?: ZodType<PathParamsOutput, ZodTypeDef, PathParamsInput>,
54-
queryParams?: ZodType<QueryParamsOutput, ZodTypeDef, QueryParamsInput>,
53+
pathParams?: ZodType<PathParamsOutput, PathParamsInput>,
54+
queryParams?: ZodType<QueryParamsOutput, QueryParamsInput>,
5555
action: (
5656
source: ActionSource<PathParamsOutput, QueryParamsOutput, RequestBodyOutput>,
5757
request: Req

src/core/path-params.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { safeParse } from "./zod-error-handler";
2-
import type { ZodError, ZodType, ZodTypeDef } from "zod";
2+
import type { ZodError, ZodType } from "zod";
33

4-
export default function parsePathParams<I, O>(source?: I, schema?: ZodType<O, ZodTypeDef, I>) {
4+
export default function parsePathParams<I, O>(source?: I, schema?: ZodType<O, I>) {
55
if (!schema) return null;
66
if (!source) throw new Error("UNNECESSARY_PATH_PARAMS");
77
try {

src/core/search-params.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { serializeArray } from "~/utils/array-serialization";
22
import { safeParse } from "./zod-error-handler";
3-
import type { ZodError, ZodType, ZodTypeDef } from "zod";
3+
import type { ZodError, ZodType } from "zod";
44

5-
export default function parseSearchParams<I, O>(source: URLSearchParams, schema?: ZodType<O, ZodTypeDef, I>) {
5+
export default function parseSearchParams<I, O>(source: URLSearchParams, schema?: ZodType<O, I>) {
66
if (!schema) return null;
77
const sourceKeys = Array.from(new Set(source.keys()));
88
const params = sourceKeys.reduce((collection, key) => {

src/types/response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { ExampleObject } from "@omer-x/openapi-types/example";
22
import type { MediaTypeObject } from "@omer-x/openapi-types/media-type";
3-
import type { ZodType, ZodTypeDef } from "zod";
3+
import type { ZodType } from "zod";
44

55
export type ResponseDefinition<O, I = O> = {
66
description: string,
77
isArray?: boolean,
88
example?: NoInfer<O>,
99
examples?: Record<string, ExampleObject<NoInfer<O>>>,
1010
} & ({
11-
content?: ZodType<O, ZodTypeDef, I> | string,
11+
content?: ZodType<O, I> | string,
1212
customContent?: never,
1313
} | {
1414
content?: never,

0 commit comments

Comments
 (0)