Skip to content

Avoid deprecated multi_json APIs while retaining legacy compatibility - #182

Draft
diazweb wants to merge 1 commit into
joshbuddy:masterfrom
diazweb:fix-multi-json-deprecations
Draft

diazweb wants to merge 1 commit into
joshbuddy:masterfrom
diazweb:fix-multi-json-deprecations

Conversation

@diazweb

@diazweb diazweb commented Oct 15, 2026

Copy link
Copy Markdown

Summary

Fixes #181 without raising jsonpath's Ruby requirement or forcing older Ruby users onto multi_json 1.21 (which requires Ruby >= 3.2).

  • Use MultiJSON.parse when the modern constant exists. This avoids both the deprecated MultiJson constant and the deprecated decode/load methods introduced in multi_json 1.21. Merely replacing decode with load would still warn on current releases.
  • Otherwise use the supported legacy MultiJson.load API. Declare its minimum multi_json version (1.3) in the gemspec.
  • Preserve non-string inputs and forwarding of max_nesting.
  • Add a fresh-process regression with warnings enabled, so multi_json's warn-once behavior cannot conceal a regression depending on test order. Update the existing nesting-error assertion to use the canonical constant where available.

Validation

Ruby 4.0.7, upstream's declared minitest 2.2.2:

ruby -W:deprecated -Ilib -e 'gem "minitest", "2.2.2"; gem "multi_json", "1.21.1"; load "test/test_jsonpath.rb"'
ruby -W:deprecated -Ilib -e 'gem "minitest", "2.2.2"; gem "multi_json", "1.15.0"; load "test/test_jsonpath.rb"'

Each: 119 tests, 187 assertions, 0 failures, 0 errors, 2 existing skips. These are the core test/test_jsonpath.rb tests, not a claim that the entire Rake/CLI suite or older Ruby matrix was run. Before the implementation change, the new warning regression failed with both the deprecated constant and decode warnings.

Also verified the downstream k8s-ruby 0.18.0 K8s::Transport.token_from_auth_provider command-output/token-key path with a local /usr/bin/printf fixture, no cluster/network access: same extracted token before/after; both warnings before, no warnings after. Explicit-token client initialization does not invoke JsonPath.

Scope

Draft for maintainer review. No consumer fork dependency, monkeypatch, warning suppression, Ruby requirement change, or unrelated dependency upgrade. A released jsonpath fix is needed before downstream applications can consume this through a normal gem update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MultiJson.decode is deprecated

1 participant