Allow json 3.x - #388
Open
dduugg wants to merge 1 commit into
Open
Conversation
Widen the json runtime dependency so the gem can be used in bundles that resolve json 3.x. The full spec suite passes on json 3.0.0.rc1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Widens the
jsonruntime dependency from~> 2.1, >= 2.1.0to>= 2.1.0, < 4, so the gem can be installed in bundles that resolve json 3.x.Gemfile.lockis updated to match the new constraint. The resolved json version in the lock is left at2.7.2to keep the diff minimal.Why
json 3.0.0.rc1 was released on 2026-08-11. Because
~> 2.1means>= 2.1, < 3.0, this gem currently blocks any application in the same bundle from upgrading, even though the SDK itself is unaffected by the 3.0 changes. We hit this while testing json 3.0.0.rc1 in a large Rails application.Why this is safe
lib/xero-ruby/api_client.rbis the only place the SDK touches the json API, and each call site is compatible with 3.0:JSON.parse(response.body)(×3)JSON.parse("[#{body}]", :symbolize_names => true)symbolize_namesis still a supported option, and it is passed as inline keyword arguments, so the stricter keyword handling in 3.0 does not affect itrescue JSON::ParserErrorbody.to_json(×2)JSON::JWK::Set/JSON::JWTjson-jwt, notjson.json-jwt1.17.2 resolves cleanly alongside json 3.0.0.rc1None of the removed 3.0 APIs (
create_additions,JSON::GenericObject,Kernel#j/#jj,JSON.unparse,JSON.fast_generate,JSON.restore,JSON::State#[]) are used anywhere inlib/.Verification
Full spec suite on Ruby 3.4.10 with json 3.0.0.rc1 resolved:
(One pre-existing rspec deprecation warning about implicit block expectation syntax, unrelated to this change.)
The upper bound
< 4is retained so a future json 4.0 does not silently become eligible.required_ruby_versionis left at>= 2.3— bundler will still resolve json 2.x on rubies too old for json 3.Note on codegen
I see from CONTRIBUTING.md that this SDK is generated via OpenAPI Generator, so this gemspec change likely needs to be made in the corresponding mustache template as well for it to survive the next regeneration. Happy to point at the template or close this in favour of an issue if that is the preferred path.