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

Allow client option for custom dispatcher into fetch requests (e.g. to disable certificate validation) #1631 #1636

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mellster2012
Copy link

@mellster2012 mellster2012 commented Apr 27, 2024

Changes

Fix for #1631

How to Review

How can a reviewer review your changes? What should be kept in mind for this review?

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

Copy link

changeset-bot bot commented Apr 27, 2024

⚠️ No Changeset found

Latest commit: cbcb1ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mellster2012
Copy link
Author

Is there anything we can do to re-run failed workflows? Thanks!

@drwpow
Copy link
Owner

drwpow commented May 16, 2024

Is there anything we can do to re-run failed workflows? Thanks!

Unfortunately no; there’s just a requirement that new contributors need to have manually-run workflows until they’ve gotten a PR merged. I think it’s just GitHub saving $ (which is fine by me, because of how generously they provide so many resources for OSS).

@drwpow
Copy link
Owner

drwpow commented May 16, 2024

See comment on #1631. I think we need a little more discussion / clarification on what this PR is accomplishing, because on first glance it’s not clear. So that’s priority 1.

I’ll also leave a few comments on this PR—even if it gets reworked—just to give a sense of what we’re looking for when contributing to this project.


afterAll(() => server.close());

describe("TypeScript checks", () => {
Copy link
Owner

Choose a reason for hiding this comment

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

Appreciate you adding so many test cases to this PR, but we don’t want to just flat-out copy the entire test suite just for one change. I would suspect most of the tests don’t actually test this code path at all; we probably only need 1 or 2 new tests to start.

There may be some confusion with the v7-beta.test.ts file; that’s a separate case. It’s because when openapi-typescript 7.x gets a stable release, we’ll have to make a breaking release for openapi-fetch as well, and I’m just making sure that transition is smooth. But again, for a single option, we don’t need to copy all the tests

Copy link
Author

Choose a reason for hiding this comment

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

Removed the extra test file and just added one test under options specifying a custom dispatcher - without it hitting a 'bad cert' website it only validates that specifying a custom dispatcher does not break general functionality.

package.json Outdated
@@ -20,6 +20,7 @@
"@changesets/cli": "^2.27.1",
"del-cli": "^5.1.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
"typescript": "^5.4.5",
"undici": "^6.14.1"
Copy link
Owner

Choose a reason for hiding this comment

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

We’re only using undici in a single test in openapi-fetch, so we want to add it to devDependencies in that package.json; not for the entire monorepo.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@@ -15,6 +15,8 @@ import type {
export interface ClientOptions extends Omit<RequestInit, "headers"> {
/** set the common root URL for all API requests */
baseUrl?: string;
/** custom dispatcher */
dispatcher?: unknown;
Copy link
Owner

Choose a reason for hiding this comment

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

We’ll want a more accurate type for this.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants