Spaces:
Build error
Build error
| import { defineConfig, InputTransformerFn } from "orval"; | |
| import path from "path"; | |
| const root = path.resolve(__dirname, "..", ".."); | |
| // const apiClientReactSrc = path.resolve(root, "lib", "api-client-react", "src"); // This client is not used for API server deployment | |
| const apiZodSrc = path.resolve(root, "artifacts", "api-zod", "src"); // Generate into artifacts/api-zod/src | |
| // Our exports make assumptions about the title of the API being "Api" (i.e. generated output is `api.ts`). | |
| const titleTransformer: InputTransformerFn = (config) => { | |
| config.info ??= {}; | |
| config.info.title = "Api"; | |
| return config; | |
| }; | |
| export default defineConfig({ | |
| // Removed "api-client-react" configuration as it's not needed for API server and causes build failures. | |
| zod: { | |
| input: { | |
| target: "./openapi.yaml", | |
| override: { | |
| transformer: titleTransformer, | |
| }, | |
| }, | |
| output: { | |
| workspace: apiZodSrc, | |
| client: "zod", | |
| target: "generated", | |
| schemas: { path: "generated/types", type: "typescript" }, | |
| mode: "split", | |
| clean: true, | |
| prettier: true, | |
| override: { | |
| zod: { | |
| coerce: { | |
| query: ['boolean', 'number', 'string'], | |
| param: ['boolean', 'number', 'string'], | |
| body: ['bigint', 'date'], | |
| response: ['bigint', 'date'], | |
| }, | |
| }, | |
| useDates: true, | |
| useBigInt: true, | |
| }, | |
| }, | |
| }, | |
| }); | |