asteasolutions / zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas
MIT License
788 stars 52 forks source link

Version 7.0.0 is not compatible with the latest release of openapi-ts@4.3.2 #235

Closed callmeberzerker closed 3 weeks ago

callmeberzerker commented 1 month ago

See this PR https://github.com/metadevpro/openapi3-ts/pull/117

# pnpm why openapi-ts
devDependencies:
@asteasolutions/zod-to-openapi 7.0.0
└── openapi3-ts 4.3.2

Error reported:

Found 6 errors in 4 files.

Errors  Files
     2  node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.0.0_zod@3.23.8/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-registry.d.ts:1
     1  node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.0.0_zod@3.23.8/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.d.ts:1
     1  node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.0.0_zod@3.23.8/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.d.ts:1
     2  node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.0.0_zod@3.23.8/node_modules/@asteasolutions/zod-to-openapi/dist/zod-extensions.d.ts:1

Reproduction steps:

  1. Create a new TS project with module setting in tsconfig.json to CommonJS.
  2. Run pnpm install
  3. Run pnpm tsc
reju1021 commented 1 month ago

Just ran into the same problem. I also tried out different older versions which are all also affected by this.

AGalabov commented 1 month ago

@callmeberzerker thank you for reporting that. We will look at this as soon as we can.

@reju1021 do you mean that this is also a problem on older openapi3-ts versions or older versions of @asteassolutions/zod-to-openapi

reju1021 commented 1 month ago

@AGalabov seems to be the case for older versions of @asteassolutions/zod-to-openapi too. Thanks for looking into this!

andreujuanc commented 3 weeks ago

Pinning the version works for me: "openapi3-ts": "4.3.1"

andreujuanc commented 3 weeks ago

Update: this fixed the problem: https://github.com/metadevpro/openapi3-ts/pull/138 give some thumbs up xD

reju1021 commented 3 weeks ago

Appreciate the fix @andreujuanc - this resolved the issue for me as well! :)

AGalabov commented 3 weeks ago

@andreujuanc thank you for the fix. I will close the issue