From 060a9e102412c61e5e25d3b7ebe8758f9f2985fd Mon Sep 17 00:00:00 2001 From: Etienne Donneger Date: Tue, 6 Aug 2024 14:06:54 +0000 Subject: [PATCH] Fix Bun codegen script and some comments (#56) --- index.ts | 1 - package.json | 2 +- src/types/README.md | 2 +- src/types/api.ts | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 860df46..e7c4f4b 100644 --- a/index.ts +++ b/index.ts @@ -9,7 +9,6 @@ import { logger } from './src/logger.js'; import * as prometheus from './src/prometheus.js'; import { makeUsageQuery } from "./src/usage.js"; import { APIErrorResponse } from "./src/utils.js"; -// import { fixEndpointParametersCoercion } from "./src/types/api.js"; import type { Context } from "hono"; import type { EndpointReturnTypes, UsageEndpoints, ValidPathParams, ValidUserParams } from "./src/types/api.js"; diff --git a/package.json b/package.json index 2be7eb8..c058905 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "lint": "export APP_VERSION=$(git rev-parse --short HEAD) && bun run tsc --noEmit --skipLibCheck --pretty", "start": "export APP_VERSION=$(git rev-parse --short HEAD) && bun index.ts", "test": "bun test --coverage", - "types": "bun run tsp compile ./src/typespec && bun run typed-openapi ./tsp-output/@typespec/openapi3/openapi.json -o ./src/types/zod.gen.ts -r zod", + "types": "bun run tsp compile ./src/typespec && bun run kubb", "types:check": "bun run tsp compile ./src/typespec --no-emit --pretty --warn-as-error", "types:format": "bun run tsp format src/typespec/**/*.tsp", "types:watch": "bun run tsp compile ./src/typespec --watch --pretty --warn-as-error" diff --git a/src/types/README.md b/src/types/README.md index cbd2004..91b19eb 100644 --- a/src/types/README.md +++ b/src/types/README.md @@ -1,7 +1,7 @@ ### `zod.gen.ts` > [!WARNING] -> **DO NOT EDIT**: Auto-generated [Zod](https://zod.dev/) schemas definitions from the [OpenAPI3](../tsp-output/@typespec/openapi3/openapi.json) specification using [`typed-openapi`](https://github.com/astahmer/typed-openapi/). +> **DO NOT EDIT**: Auto-generated [Zod](https://zod.dev/) schemas definitions from the [OpenAPI3](../tsp-output/@typespec/openapi3/openapi.json) specification using [`Kubb`](https://kubb.dev). Use `bun run types` to run the code generation for Zod schemas. diff --git a/src/types/api.ts b/src/types/api.ts index 9f4f61d..45eb67b 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -19,5 +19,5 @@ export type ValidUserParams = EndpointParameters ex : z.infer["query"] & ValidPathParams>; export type AdditionalQueryParams = { offset?: number; min_block?: number; max_block?: number; }; -// Allow any valid parameters from the endpoint to be used as SQL query parameters with the addition of the `OFFSET` for pagination +// Allow any valid parameters from the endpoint to be used as SQL query parameters export type ValidQueryParams = ValidUserParams & AdditionalQueryParams;