Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate client via NPX since 13.0.24 #1124

Closed
JamiroFerrara opened this issue Mar 25, 2025 · 5 comments
Closed

Unable to generate client via NPX since 13.0.24 #1124

JamiroFerrara opened this issue Mar 25, 2025 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@JamiroFerrara
Copy link

Running:
npx swagger-typescript-api --axios --module-name-index 1 --unwrap-response-data -t ./client/templates -p swagger.json -o ./client -n client.ts

has broken since the recent updates.
Partial fix is to force the 13.0.23 version.

npx [email protected]

otherwise i get this error:

ERROR error while fetching data from URL "swagger.json" Failed to parse URL from swagger.json 3:57:11 PM

at node:internal/deps/undici/undici:12344:11
at async Ee.download (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:5721)
at async be.fetchSwaggerSchemaFile (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6978)
at async be.create (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6093)
at async ve.start (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:39:2079)
at async Va (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:41:4132)
at async Object.run (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/cli.js:2:6176)
at async runCommand (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:316:16)
at async runCommand (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:307:11)
at async runMain (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:445:7)

[cause]: Invalid URL

  at new URL (node:internal/url:775:36)
  at new Request (node:internal/deps/undici/undici:5853:25)
  at fetch (node:internal/deps/undici/undici:10123:25)
  at Object.fetch (node:internal/deps/undici/undici:12343:10)
  at fetch (node:internal/process/pre_execution:335:27)
  at Ee.download (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:5727)
  at be.fetchSwaggerSchemaFile (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6997)
  at be.create (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6104)
  at ve.start (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:39:2112)
  at Va (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:41:4148)

ERROR Cannot create property 'info' on string 'error while fetching data from URL "swagger.json"' 3:57:11 PM

at /home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6301
at new Promise (<anonymous>)
at be.convertSwaggerObject (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6254)
at be.create (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:24:6187)
at async ve.start (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:39:2079)
at async Va (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/chunk-TXFFSIK5.js:41:4132)
at async Object.run (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/swagger-typescript-api/dist/cli.js:2:6176)
at async runCommand (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:316:16)
at async runCommand (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:307:11)
at async runMain (/home/jferrara/.npm/_npx/8fa9b25d390f32b2/node_modules/citty/dist/index.mjs:445:7)

ERROR Cannot create property 'info' on string 'error while fetching data from URL "swagger.json"' 3:57:11 PM

@smorimoto
Copy link
Collaborator

Could you try 13.0.28?

@mpiltz
Copy link

mpiltz commented Mar 26, 2025

We have also issues with the CLI starting from 0.24. It seems that the 13.0.24 introduced a new CLI that requires us to provide one of the commands compared to the old CLI that defaulted to generate-api.

Old:
13.0.23...13.0.24#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346L316

New:
13.0.23...13.0.24#diff-dcdc3e0b3362edb8fec2a51d3fa51f8fb8af8f70247e06d9887fa934834c9122R344

@smorimoto smorimoto added the bug Something isn't working label Mar 27, 2025
@craig-jennings
Copy link

craig-jennings commented Apr 1, 2025

Just to chime in, I upgraded from 13.0.23 to 13.0.28 and hit the same problem. The resolution was to be specific and run sta generate <options> instead of just sta <options>.

Not sure if this is the desired behavior or not, but it is a change in behavior.

@smorimoto smorimoto added documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 1, 2025
@smorimoto
Copy link
Collaborator

Well, it was actually kind of a breaking change...

@smorimoto
Copy link
Collaborator

smorimoto commented Apr 1, 2025

docs are updated by this commit: 422c850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants