Faraday 2.0 #1358
Replies: 7 comments 27 replies
-
Lots of feedback on the lack of a default adapter coming from this tweet: https://twitter.com/getajobmike/status/1478586924998688768?s=20 |
Beta Was this translation helpful? Give feedback.
-
Issues around supporting both v1.0 and v2.0 in gems that depend on Faraday have been raised here: lostisland/faraday-retry#3 (comment) |
Beta Was this translation helpful? Give feedback.
-
@iMacTia So... one thing I'm learning is how many nooks and crannies in my dependency tree have faraday as a dependency. So I wind up with it many times at many levels in my dependency tree. I of course can't upgrade the app (or gem) I'm starting at to use faraday 2, until all the references in it's dependency tree allow faraday 2. (And if some support ONLY faraday 2 and otheres ONLY faraday 1... I'm stuck using old versions of the ones whose newest releases are only faraday 2, until everything supports faraday 2). So I've been jumping around github filing issues and PRs trying to upgrade to faraday 2. Sometimes upgrading to faraday 2 has unexpected barriers, that aren't actually about faraday's own code. Like the gem I'm trying to issue a PR on has it's own dependency that doesn't allow faraday 2 yet (and it could be a dependency only in CI but not a runtime dependency in gemspec). Or the gem's Here a couple recent examples: oauth-xx/oauth2#569 danger/danger#1349 So.. this is a lot. I understand why some gems I am coming across chose to migrate away from faraday as a reponse to the 2.0 release. In retrospect... faraday is really a sort of "plumbing" gem. One of it's popular historical use cases is in gems, to let the client app (the thing using the gem) customize the http connection in the gem -- by choosing whatever adapter the client app wants, or adding middleware, etc. This is neat, gems can let client apps do a lot of customization on the HTTP connectons it uses via faraday API without having to invent their own architectures and APIs for this . (You're on jruby so want a different adapter? No problem! You want to configure automatic retry or client-side cache? No problem!). It's faraday providing a lot of value! But as a result, faraday can show up at multiple points deep in a dependency tree. And as a result of that... it's really hard to deal with any backwards incompatibilities, or any major version releases (that will not be included as allowed in specifications in existing gemspecs). Almost infeasible. Some projects will probably be stuck on faraday 1 for quite some time, others are going to be stuck between a rock and a hard place if recent releases of some dependencies require only faraday 1, but others only faraday 2. I would urge seriously considering, like, never doing a backwards breaking change/major release again. If that's not realistic, then the serious cost of it should be considered, and hopefully such will be as rare going forward, if not more so, as it has been so far. Upping the cadence of major version releases could be really disastrous. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback @jrochkind, I can totally relate to pretty much all the points you've raised above. Every time we do a major release, we try and do our best to minimize breaking changes, but the real issue is that gem owners will still apply version locking to avoid the next major version from automatically being used (and rightly so, it's a pretty common and sensible thing to do!). It's hard to predict when and how a v3 will happen, and we'll obviously postpone it as much as possible by avoiding backwards-incompatible changes as much as possible, but it will happen at some point. I really appreciate you taking the time to go through all these gems and trying to move things forward. I also saw the PR in Sawyer (lostisland/sawyer#70) which happens to be a Note taken on the cadence of major releases, I just wanted to provide some extra context around what has been done, what we're doing, and how we hope future major releases will be easier thanks to that ❤️ . |
Beta Was this translation helpful? Give feedback.
-
The basic_auth changes are currently a pain for me. I'm getting this in my logs:
When I go to the URL it suggests for more usage info... I don't see any examples that look like I wonder if it would be helpful if the documentation URL showed the old deprecated (and won't work in faraday 2.x) way too, so to help someone arriving there understand what code in their present codebase is the "bad" way. I'm not sure I understand the "bad" way, can you give me an example of what code that triggers this deprecation warning might look like? I'm also not totally sure what in my app is triggering this, since there's no stack trace in my logs at present. I can do more detective work to find it. Once i do... and it's probably a gem dependency not my direct app... If a gem dependency needs to do basic auth, and wants to support both faraday 1.x and 2.x to ease upgrade... do you have any advice for how an app can do basic auth and support both faraday 1 and 2? Some kind of conditional code? |
Beta Was this translation helpful? Give feedback.
-
I am hoping for some advice on how to handle :follow_redirects in a codebase that would ideally support faraday 1.0 or 2.0. I have an old barely-maintained dependency (ruby gem Because Is there a way for a codebase to have The faraday_middleware README says "All other middleware, they'll be re-released as independent gems compatible with both Faraday v1 and v2" -- has this happened for faraday-redirect? I can't find it. But it also doesn't seem to be included in faraday core, I don't see any functionality for following redirects in there. Thanks for any advice! Certainly one last-ditch solution would just be copying the faraday middleware code into the local codebase and just using it from there. |
Beta Was this translation helpful? Give feedback.
-
Faraday 2.0 🎉
The next major release is here, and it comes almost 2 years after the release of v1.0!
This release changes the way you use Faraday and embraces a new paradigm of Faraday as an ecosystem, rather than a library.
What does that mean? It means that Faraday is less of a bundled tool and more of a framework for the community to build on top of.
As a result, all adapters and some middleware have moved out and are now shipped as standalone gems 🙌!
But this doesn't mean that upgrading from Faraday 1.x to Faraday 2.0 should be hard, in fact we've listed everything you need to do in the UPGRADING.md doc.
Moreover, we've setup a new awesome-faraday repository that will showcase a curated list of adapters and middleware 😎.
This release was the result of the efforts of the core team and all the contributors, new and old, that have helped achieve this milestone 👏.
What's Changed
New Contributors
Full Changelog: v1.8.0...v2.0.0
This discussion was created from the release v2.0.0.
Beta Was this translation helpful? Give feedback.
All reactions