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.
Problem
netbox-client-ruby
is not compatible with Faraday 2.x.Solution
BREAKING CHANGE
To support for Faraday 2, the explicit dependency on "faraday_middleware" must be dropped. "faraday_middleware" is a deprecated gem designed to work with Faraday 0.x and 1.x but not 2.x.
Netbox Client Ruby uses "faraday_middleware" to process request/response with JSON
encoding/decoding middleware for Faraday 0.x and 1.x. In Faraday 2, JSON middleware is supplied by the Faraday gem.
This change removes "faraday_middleware" as an explicit dependency from the gemspec. It is still however treated as a peer dependency in that Netbox Client Ruby will attempt to require "faraday_middleware" if Faraday < 2 is detected at runtime. A helpful error message is raised if it is not installed.
This is an opinionated change that makes the assumption that Netbox Client Ruby still wants to support Faraday 0.x and 1.x alongside 2.x. How long to continue supporting older versions of Faraday is a question. Also, as Netbox Client Ruby is still pre-1.0, I assume that breaking changes do not necessarily require a major version release per SemVer, but that is worth considering.
Notes
In Faraday 2, HTTP adapters are extracted to separate gem. Because tests expect the presence of
:net_http_persistent
adapter, the "faraday-net_http_persistent" gem is added conditionally for development and CI.A new error class,
Error
is added to help communicate the load error for "faraday_middleware" originates from Netbox Client Ruby. This is similar to what Faraday does when it cannot load a middleware dependency at runtime.The existing error classes are consolidated in
error.rb
and made subclasses ofError
, which is also consistent with how Faraday handles custom errors.Gemfile.lock
is now added to version control. This is based on Bundler's recommendation for using Gemfile in gems, notably, to ensure contributors all have a consistent experience when checking out the gem. We can also now addGemfile
to the new Ruby version matrix in CI and ensure consistency between local and CI.