asteasolutions / zod-to-openapi

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

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

Closed callmeberzerker closed 4 months ago

callmeberzerker commented 5 months 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 5 months ago

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

AGalabov commented 5 months 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 5 months ago

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

andreujuanc commented 4 months ago

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

andreujuanc commented 4 months ago

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

reju1021 commented 4 months ago

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

AGalabov commented 4 months ago

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