Skip to content

Commit fbcf58f

Browse files
committed
Fix error
1 parent 8f3762e commit fbcf58f

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

examples/misc/simple/withValidation.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { withValidation } from "@notainc/typed-api-spec/fetch";
22
import { z } from "zod";
33
import { SpecValidatorError } from "@notainc/typed-api-spec/fetch";
4-
import { SSApiEndpoints } from "@notainc/typed-api-spec/core";
4+
import { ApiEndpointsSchema } from "@notainc/typed-api-spec/core";
55

66
const GITHUB_API_ORIGIN = "https://api.github.com";
77

@@ -12,15 +12,15 @@ const spec = {
1212
responses: { 200: { body: z.object({ names: z.string().array() }) } },
1313
},
1414
},
15-
} satisfies SSApiEndpoints;
15+
} satisfies ApiEndpointsSchema;
1616
const spec2 = {
1717
"/repos/:owner/:repo/topics": {
1818
get: {
1919
// Invalid response schema
2020
responses: { 200: { body: z.object({ noexist: z.string() }) } },
2121
},
2222
},
23-
} satisfies SSApiEndpoints;
23+
} satisfies ApiEndpointsSchema;
2424

2525
const main = async () => {
2626
{

examples/misc/spec/valibot.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { SSApiEndpoints, ToApiEndpoints } from "@notainc/typed-api-spec/core";
1+
import {
2+
ApiEndpointsSchema,
3+
ToApiEndpoints,
4+
} from "@notainc/typed-api-spec/core";
25
import * as v from "valibot";
36

47
const JsonHeader = v.object({
@@ -41,5 +44,5 @@ export const pathMap = {
4144
},
4245
},
4346
},
44-
} satisfies SSApiEndpoints;
47+
} satisfies ApiEndpointsSchema;
4548
export type PathMap = ToApiEndpoints<typeof pathMap>;

examples/misc/spec/zod.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { SSApiEndpoints, ToApiEndpoints } from "@notainc/typed-api-spec/core";
1+
import {
2+
ApiEndpointsSchema,
3+
ToApiEndpoints,
4+
} from "@notainc/typed-api-spec/core";
25
import { z } from "zod";
36

47
const JsonHeader = z.union([
@@ -42,5 +45,5 @@ export const pathMap = {
4245
},
4346
},
4447
},
45-
} satisfies SSApiEndpoints;
48+
} satisfies ApiEndpointsSchema;
4649
export type PathMap = ToApiEndpoints<typeof pathMap>;

pkgs/typed-api-spec/src/core/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ export * from "./validator/validate";
77
export * from "./validator/request";
88
export * from "./validator/response";
99
export * from "./openapi";
10+
export * from "./schema";

pkgs/typed-api-spec/src/core/openapi/openapi.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ import {
1717
ToOpenApiResponse,
1818
} from "./spec";
1919
import { StandardSchemaV1 } from "@standard-schema/spec";
20-
import { ApiResponseSchema } from "../schema";
20+
import { AnyStandardSchemaV1, ApiResponseSchema } from "../schema";
2121
import { toJsonSchemaApiEndpoints } from "../jsonschema";
2222

23-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24-
type AnyStandardSchemaV1 = StandardSchemaV1<any>;
2523
export type SSOpenApiEndpoints = {
2624
[Path in string]: SSOpenApiEndpoint;
2725
};

pkgs/typed-api-spec/src/core/validator/validate.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import {
1111
MethodInvalidError,
1212
newMethodInvalidError,
1313
} from "../spec";
14-
import { ApiResponsesSchema, ApiSpecSchema } from "../schema";
14+
import {
15+
AnyStandardSchemaV1,
16+
ApiResponsesSchema,
17+
ApiSpecSchema,
18+
} from "../schema";
1519
import { ApiEndpointsSchema } from "../schema";
1620
import {
1721
AnySpecValidator,
@@ -29,10 +33,6 @@ import {
2933
import { StatusCode } from "../hono-types";
3034
export type SSResult<Data> = SS.Result<Data> | Promise<SS.Result<Data>>;
3135

32-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33-
export type AnyStandardSchemaV1 = SS<any>;
34-
35-
// export type Validator<Data> = () => SSResult<Data>;
3636
export type Validator<V extends AnyStandardSchemaV1 | undefined> =
3737
V extends AnyStandardSchemaV1
3838
? () => SSResult<NonNullable<SS.InferOutput<V>>>

0 commit comments

Comments
 (0)