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

feat(openapi-fetch): add support for arbitrary method #2063

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kerwanp
Copy link
Contributor

@kerwanp kerwanp commented Dec 21, 2024

Changes

This Pull request closes #1808 by providing a request method that accept a method as its first arguments allowing to pass any HttpMethod. Making library authors' life easier.

This does not introduce any breaking change.

How to Review

A new request should be available on the client that must behave exactly like the other GET, OPTIONS, etc methods but with the ability to pass the HttpMethod as first parameter.

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)

@kerwanp kerwanp requested a review from a team as a code owner December 21, 2024 16:10
@kerwanp kerwanp requested a review from drwpow December 21, 2024 16:10
Copy link

netlify bot commented Dec 21, 2024

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2335067

Copy link

changeset-bot bot commented Dec 21, 2024

🦋 Changeset detected

Latest commit: 2335067

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
openapi-fetch Minor
openapi-react-query Major
swr-openapi Major

Not sure what this means? Click here to learn what changesets are.

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

@kerwanp kerwanp added enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library labels Dec 21, 2024
@@ -0,0 +1,5 @@
---
"openapi-fetch": minor
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a patch because it doesn’t introduce a breaking change (that I’m aware of)

Suggested change
"openapi-fetch": minor
"openapi-fetch": patch

Copy link
Contributor Author

@kerwanp kerwanp Dec 21, 2024

Choose a reason for hiding this comment

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

According to semver:

MAJOR version when you make incompatible API changes
MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

As it brings a new feature and is backward compatible. Imo it should be a minor

Copy link
Contributor

@drwpow drwpow Dec 21, 2024

Choose a reason for hiding this comment

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

That only applies for > 1.0! For 0.x, it’s more standard to smush bugfixes/features into patches, and use minor for breaking changes. It helps people plan more accordingly. Semver dictates that 0.x releases are allowed to make breaking changes at any time, and even though this method isn’t “official,” it’s a very common pattern, and one that openapi-fetch has followed since the beginning.

Put another way, for 0.x, you have to either use minor for breaking + feature, or patch for feature + bugfix. It’s basically a coin toss, and we have been historically going with the latter for now.

But you are correct—that becomes the pattern as soon as 1.0 is released and thereafter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not aware of this! Thanks for letting me know, I'll update that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[openapi-fetch] Provide client.request() to support dynamic method.
2 participants