Repository navigation
Conversation
| @@ -26,6 +26,6 @@ Gem::Specification.new do |gem| | |||
| gem.add_runtime_dependency 'googleauth', '~> 1.14' | |||
| gem.add_runtime_dependency 'mini_mime', '~> 1.1' | |||
| gem.add_runtime_dependency 'multi_json', '~> 1.11' | |||
There was a problem hiding this comment.
bump multi_json to '~> 1.21'
torreypayne
left a comment
There was a problem hiding this comment.
@larouxn LGTM to bump the dependencies for maintenance, but are you sure this update actually clears the warnings? Can you repro?
Thanks for the review! Good call. Unfortunately I believe that due to this (temporary I hope) compatibility fix some deprecation warnings will still appear. I suppose until Reproduction Test (disclaimer: LLM assisted) Running this script with # test_repro.rb
require "multi_json" # 1.21.1
require "representable/json"
class Model
attr_accessor :name
def initialize(name = nil); @name = name; end
end
module ModelRepresenter
include Representable::JSON
property :name
end
m = Model.new("Alice")
m.extend(ModelRepresenter).to_json
Model.new.extend(ModelRepresenter).from_json('{"name":"Bob"}')Result with The MultiJson constant is deprecated and will be removed in v2.0. Use MultiJSON instead.
MultiJSON.dump is deprecated and will be removed in v2.0. Use MultiJSON.generate instead.
MultiJSON.load is deprecated and will be removed in v2.0. Use MultiJSON.parse instead.Result with The MultiJson constant is deprecated and will be removed in v2.0. Use MultiJSON instead.
MultiJSON.dump is deprecated and will be removed in v2.0. Use MultiJSON.generate instead.
MultiJSON.load is deprecated and will be removed in v2.0. Use MultiJSON.parse instead.Note: If we remove |
8bd2ca8 to
c2730d8
Compare
|
Rebased on latest |
| gem.add_runtime_dependency 'multi_json', '~> 1.11' | ||
| gem.add_runtime_dependency 'representable', '~> 3.0' | ||
| gem.add_runtime_dependency 'multi_json', '~> 1.21' | ||
| gem.add_runtime_dependency 'representable', '~> 3.3' |
There was a problem hiding this comment.
Could this be '~> 3.3', '>= 3.3.1'?
With multi_json 1.21, representable 3.3.0 still sends to_json/from_json through the deprecated MultiJson.dump/load, which matches your repro showing the same warnings on 3.2.0 and 3.3.0.
3.3.1 (trailblazer/representable#300) fixes this, and for me the warnings go away with it:
ruby -W:deprecated test_repro.rb
# representable 3.3.0 + multi_json 1.21.1: 3 deprecation warnings
# representable 3.3.1 + multi_json 1.21.1: none
| gem.add_runtime_dependency 'mini_mime', '~> 1.1' | ||
| gem.add_runtime_dependency 'multi_json', '~> 1.11' | ||
| gem.add_runtime_dependency 'representable', '~> 3.0' | ||
| gem.add_runtime_dependency 'multi_json', '~> 1.21' |
There was a problem hiding this comment.
Could this be '~> 1.21', '>= 1.21.2'?
multi_json 1.21.2 added json 3.x support (https://github.com/sferik/multi_json/blob/main/CHANGELOG.md#1212---2026-09-07), and older versions raise ArgumentError: wrong number of arguments (given 2, expected 1) on every to_json/from_json when json 3.x is in the bundle. With representable 3.3.1 and json 3.1.0, the google-apis-core specs give:
multi_json 1.21.1: 524 examples, 44 failures (all ArgumentError)
multi_json 1.21.2: 524 examples, 0 failures
One bundle lock --update multi_json representable --conservative would pick up both bumps in Gemfile.lock. With both changes merged onto current main, the specs pass on Ruby 3.2 through 4.0.
|
Thanks for your patience with this review, and sorry for the delays. If you don't have time for these two tweaks, no problem: I'm happy to push them to your branch in a couple of days so we can get this merged. |
c2730d8 to
bfd05a7
Compare
|
👋 @quartzmo, thanks a bunch for the review and good call on setting the minimum allowed versions in the Gemspec for |
To ensure we don't encounter
representablegem basedMultiJsondeprecation warnings I am proposing we raise therepresentablegem version requirement from'~> 3.0'to'~> 3.3', '>= 3.3.1'andmulti_jsongem version requirement from'~> 1.11'to'~> 1.21', '>= 1.21.2'.Relevant links