Detect the MultiXML constant to avoid the multi_xml deprecation#2765
Merged
Conversation
35108ef to
859d5cb
Compare
Danger ReportNo issues found. |
859d5cb to
6025bf4
Compare
multi_xml 0.9.0 deprecated the `MultiXml` constant in favor of `MultiXML` (removed in v1.0); the legacy constant warns on access/use. Grape detected the backend via `::MultiXml` and called `Grape::Xml.parse`, so users on multi_xml >= 0.9 would hit the deprecation. Detect `::MultiXML` first, falling back to the legacy `::MultiXml` constant and then `ActiveSupport::XmlMini`. Unlike multi_json, no facade is needed: `parse` is canonical (not renamed) and Grape only calls `parse`, so a direct alias suffices on every backend. Cover both multi_xml lines in CI: pin gemfiles/multi_xml.gemfile to >= 0.9 and add gemfiles/multi_xml_0_8.gemfile (< 0.9), each running the spec/integration/multi_xml suite. The integration spec now drives a real Grape API that parses an XML request body through Grape::Xml.parse. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6025bf4 to
bbfc83a
Compare
Contributor
Author
|
@dblock I'm gonna cut a version after this one. |
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.
Background
multi_xml 0.9.0 renamed its constant from
MultiXmltoMultiXML(same modernization as multi_json 1.21.0, by the same author).MultiXmlis now a deprecated alias, removed in v1.0, that emits a one-time warning on constant access or method call:lib/grape/xml.rbdetected the backend via::MultiXmlandGrape::Xml.parseresolved toMultiXml.parse, so users on multi_xml >= 0.9 would hit the deprecation.What this PR does
Detect
::MultiXMLfirst, then fall back to the legacy::MultiXmlconstant, thenActiveSupport::XmlMini:Grape::Xml::MultiXML::MultiXml::ActiveSupport::XmlMiniUnlike the multi_json counterpart (#2764), no facade is needed. multi_xml's only method-level deprecation is
load→parse, and Grape calls onlyparse, which is canonical (not renamed) on every backend — so a direct constant alias suffices.CI covers both multi_xml lines
gemfiles/multi_xml.gemfileis pinned to>= 0.9and a newgemfiles/multi_xml_0_8.gemfilepins< 0.9; both run thespec/integration/multi_xmlsuite, exercising theMultiXMLand legacy-MultiXmlpaths. The integration spec now drives a real Grape API that parses an XML request body throughGrape::Xml.parse(rather than a static constant-equality check), so a regression onto the deprecated constant surfaces via the suite's deprecation handler.Testing
BUNDLE_GEMFILE=gemfiles/multi_xml.gemfile bundle exec rspec spec/integration/multi_xml(>= 0.9, resolves to 0.9.1): 1 example, 0 failuresBUNDLE_GEMFILE=gemfiles/multi_xml_0_8.gemfile bundle exec rspec spec/integration/multi_xml(< 0.9, resolves to 0.8.1): 1 example, 0 failuresbundle exec rspec(no multi_xml,XmlMinifallback): 2322 examples, 0 failureslib/grape/xml.rbunder multi_xml 0.9.1 (the deprecation surfaces), confirming it guards the regression.This is the multi_xml counterpart to #2764 (multi_json).
🤖 Generated with Claude Code