ninech / netbox-client-ruby

A ruby client library for Netbox v2.
MIT License
24 stars 21 forks source link

Support Faraday 2 #65

Closed rossta closed 11 months ago

rossta commented 11 months ago

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

thde commented 11 months ago

I think keeping support for Faraday 0.x and 1.x as long as it does not create too much work is the way to go 👍🏼 .