Skip to content

feat: add --ky option#690

Closed
aleclarson wants to merge 14 commits intoacacode:mainfrom
aleclarson:feat/ky-client
Closed

feat: add --ky option#690
aleclarson wants to merge 14 commits intoacacode:mainfrom
aleclarson:feat/ky-client

Conversation

@aleclarson
Copy link

Generate a client that uses this library: https://github.com/sindresorhus/ky

@aleclarson aleclarson force-pushed the feat/ky-client branch 3 times, most recently from e42d28c to 8be147d Compare March 5, 2024 06:18
Generate a client that uses this library: https://github.com/sindresorhus/ky
@aleclarson aleclarson marked this pull request as draft March 5, 2024 06:28
Since ky has a special ResponsePromise type, the `request` method cannot use async-await syntax and the returned promise must come from ky (so the expected methods are there). This means the securityWorker cannot be supported by the ky client.
@aleclarson aleclarson marked this pull request as ready for review March 5, 2024 06:59
@aleclarson aleclarson force-pushed the feat/ky-client branch 2 times, most recently from bf2adbb to 04b800b Compare March 6, 2024 01:05
@aleclarson
Copy link
Author

If anyone is interested in using or testing this, it's published to NPM under @aleclarson/swagger-typescript-api@13.0.3.

/cc @hardouinyann @AshotN (since you both reacted)

@smorimoto smorimoto added the enhancement New feature or request label Jun 27, 2024
@smorimoto smorimoto requested a review from js2me June 27, 2024 22:58
@smorimoto smorimoto requested a review from Copilot December 28, 2024 17:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • package.json: Language not supported
  • templates/base/http-clients/ky-http-client.ejs: Language not supported
  • templates/default/procedure-call.ejs: Language not supported
  • templates/modular/procedure-call.ejs: Language not supported

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@christophehurpeau
Copy link

Is this PR still relevant ? We would love to use ky in particular with the built-in retry mechanism

@clicktodev
Copy link
Contributor

any progress on this?
i'd hate to switch to axios just because i can't generate openapi clients for ky

@clicktodev
Copy link
Contributor

clicktodev commented Nov 17, 2025

@smorimoto should we revisit this? ky is the second most popular client lib after axios

@clicktodev
Copy link
Contributor

i'm working on a PR for this but i disabled the auto response body parsing until i find the best way to make it optional ((method overload or conditional types) with parseBody as a boolean).
i wanna avoid forcing the response parsing and give the user 100% control over the response object.

@aleclarson aleclarson closed this Nov 17, 2025
@clicktodev
Copy link
Contributor

ky client that's compatible with latest version #1601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants