Closed robogeek closed 11 months ago
Hi, I wasn't aware that the generated code could have type annotations. Thank you. Anyway, I added a flag -x
that you can use to generate .ts files instead of .js files. It should get rid of that error for you.
npx openapi-to-zod -i yourinput -o /output/path -x ts
should generate .ts files now.
you should delete .js files previously generated.
Thank you, this fixed the issue.
I'm compiling the generated code using TypeScript and get this error:
The relevant generated code is:
The error indicator points at the
z.zodError[]
, and indeed(errors: type) => { function code }
is a type annotation according to Type Script.This appears at the end of nearly 1600 lines of generated code. The field in the schema where the generated code comes from is this:
The structure of the generated code is: