Open
Conversation
8fb9a1a to
92f3a6d
Compare
|
What do I need to do to use it now? |
4e2a0af to
ed6bc4f
Compare
Author
|
Hi i've updated the branch to the latest version and created an npm package with the changes. await generateApi({
fileName: "schema",
input: path.resolve(import.meta.dirname, "schema.json"),
output: tmpdir,
silent: true,
generateClient: true,
httpClientType: "ofetch",
});(Please take a look at the test files for usage examples.) I couldn't get the CLI to work for now. |
ed6bc4f to
0d17423
Compare
There was a problem hiding this comment.
Copilot reviewed 9 out of 12 changed files in this pull request and generated no comments.
Files not reviewed (3)
- templates/base/http-clients/ofetch-http-client.ejs: Language not supported
- templates/default/procedure-call.ejs: Language not supported
- README.md: Evaluated as low risk
Comments suppressed due to low confidence (2)
tests/spec/ofetch/basic.test.ts:10
- [nitpick] The variable name 'tmpdir' could be more descriptive. Consider renaming it to 'temporaryDirectory'.
let tmpdir = "";
index.ts:324
- The nested ternary operator for httpClientType assignment is confusing and could lead to unintended behavior. Consider simplifying it for better readability and maintainability.
httpClientType: args["http-client"] || args.axios ? HTTP_CLIENT.AXIOS : args.ofetch ? HTTP_CLIENT.OFETCH : HTTP_CLIENT.FETCH,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new feature to the
swagger-typescript-api, allowing users to generate a HTTP client utilizing the unjs/ofetch library for making HTTP requests. This is facilitated through the use of the--ofetchcommand-line flag. The addition of ofetch support is aimed at providing developers with more choices for their HTTP client library, especially in projects where ofetch is already in use or preferred.There may be areas of improvement or alternative approaches that could improve the implementation or usefulness of the feature. I'm open to any feedback, suggestions or contributions from the community to further refine this feature and would greatly appreciate it. :)