Skip to content

Remove multi_json support#568

Open
jordan-brough wants to merge 1 commit into
voxpupuli:masterfrom
jordan-brough:jordan/remove-multi-json
Open

Remove multi_json support#568
jordan-brough wants to merge 1 commit into
voxpupuli:masterfrom
jordan-brough:jordan/remove-multi-json

Conversation

@jordan-brough

@jordan-brough jordan-brough commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Adding multi_json to a project for an unrelated reason would silently cause json-schema to use it instead of the json gem, introducing subtle behavioral differences.

With modern Ruby and the json gem, multi_json is no longer needed.

See #565

Adding multi_json to a project for an unrelated reason would silently cause json-schema to use it
instead of the json gem, introducing subtle behavioral differences.

With modern Ruby and the json gem, multi_json is no longer needed.
@ekohl ekohl added the backwards-incompatible This change will lead to a major version bump for the next release label Feb 11, 2026
@ekohl ekohl linked an issue Feb 11, 2026 that may be closed by this pull request
@jordan-brough

Copy link
Copy Markdown
Contributor Author

@ekohl @bastelfreak is there anything further you'd like to see here, or is there anyone else to loop in?
Or are there any other options you'd like explored?

@ekohl

ekohl commented Feb 16, 2026

Copy link
Copy Markdown
Member

@bastelfreak asked whether this really is backwards incompatible or not. If it is, we should probably do a release with the current unreleased changes.

@jordan-brough

jordan-brough commented Feb 16, 2026

Copy link
Copy Markdown
Contributor Author

That makes sense. It could change behavior in some edge cases when this is merged and mutli_json stops being used.

If you think we should hold off for a major version change, we could merge #566 for now, which is backward compatible. I just now added a deprecation warning to that PR, in case you want to go that route.

@jordan-brough

Copy link
Copy Markdown
Contributor Author

@bastelfreak any thoughts on this PR? And/or merging the other PR as an interim solution?

@thomaswitt

Copy link
Copy Markdown

Hi all — landing here from a real Rails 8 app where this PR is the only thing that silences a boot-time deprecation.

multi_json 1.21 turned the legacy MultiJson constant into a one-shot deprecation forwarder that fires when lib/json-schema.rb:8 (MultiJson.respond_to?(:adapter) ? MultiJson.adapter : MultiJson.engine) runs at require time — before any consumer-set JSON::Validator.use_multi_json = false (from #566) can take effect. So the runtime opt-out is great, but doesn't silence the load-time noise.

On the backwards-compat concern that paused this thread: multi_json 1.21 keeps both MultiJson (deprecated forwarder) and MultiJSON (canonical) constants available, and similarly keeps load/dump as deprecated aliases for parse/generate. So a defined?(::MultiJSON) ? ::MultiJSON : ::MultiJson (plus respond_to?(:generate) && respond_to?(:parse) for the method names) switch silences every deprecation without bumping the gemspec floor or breaking any existing user contract on multi_json ~> 1.15. I shipped exactly that pattern in rgeo/rgeo-geojson#64 yesterday if a concrete reference helps — it's a 5-file diff with a regression test, fully backwards-compatible.

That said, the maintainer agreement upthread (@ekohl, @bastelfreak) is clearly to remove multi_json entirely, which is the cleaner long-term call. Happy to rebase this branch on top of current master and resolve the conflicts with credit to @jordan-brough if that unblocks things — just say the word.

(Mostly filing this to break the silence on the bastelfreak ping above; totally understand if waiting for a major version bump is the preferred path.)

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

Labels

backwards-incompatible This change will lead to a major version bump for the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disabling usage of multi_json even when present

3 participants