graphlient icon indicating copy to clipboard operation
graphlient copied to clipboard

Consider removing Faraday as a dependency and default to Net::HTTP

Open dblock opened this issue 8 years ago • 4 comments

Followup from #7 and #29. Currently we require Faraday and default to Graphlient::Adapters::HTTP::FaradayAdapter. We could default to Graphlient::Adapters::HTTP::HTTPAdapter and remove Faraday as a required dependency, but we lose the nice RSpec integration by default in which you can use a Faraday middleware

  let(:client) do
    Graphlient::Client.new('http://test-graphql.biz/graphql') do |client|
      client.http do |h|
        h.connection do |c|
          c.use Faraday::Adapter::Rack, app
        end
      end
    end
  end

dblock avatar Oct 26 '17 17:10 dblock

Note: Having the dependency of faraday_middleware locks Faraday to 1 or lower as Faraday 2 is not compatible with it. So if someone updates their stack or uses Faraday 2, and Graphlient, RubyGems dependency resolution will bring in graphlient 0.0.5 which was the last one without Faraday.

papile avatar Mar 24 '22 20:03 papile

@papile Give upgrading Faraday in this gem a try? Looks fairly non-trivial.

dblock avatar Mar 25 '22 13:03 dblock

I could make the Faraday adapter 1/2 compatible by dropping faraday_middleware. Another thing though might be to drop the Faraday dependency from the gemspec so it is not pulled in as a hard dependency as this original request mentions. Then developers would have to explicitly enable the Faraday adapter (or it could be selected if Faraday is defined). The default can be Net::HTTP, and the gem can be listed as a development dependency only for specs.

Faraday has been a difficult dependency in the Ruby world since they stayed at version 0.x for a really long time, got a lot of adoption, then released breaking versions 1 and then 2. So whenever they release a breaking major release it causes a large headache in updating gems.

papile avatar Mar 25 '22 14:03 papile

@papile We'll take anything that has all the specs passing :)

dblock avatar Mar 26 '22 00:03 dblock