[ruby-nextgen] Sanitize literal path segments when deriving action method names (#24998)
PR
4d ago+23+23+01234567890123456789-2-2-0123456789
Fixes #24998
In RubyApiRouting#deriveAction, literal path segments containing embedded {param} placeholders (such as {id}!preview or {id}:archive) or punctuation characters (such as . in export.csv, which StringUtils.underscore converts into /) were passed directly to underscore(...), generating invalid Ruby method definitions (def {id}!preview, def {id}:archive, def export/csv).
Changes
- Strip
{...}parameter placeholders and replace non-identifier characters with_inRubyApiRouting#deriveActionbefore callingunderscore(...). - Add unit tests in
RubyApiRoutingTest.
PR checklist
- Read the contribution guidelines.
- Existing
ruby-nextgensamples (bin/configs/ruby-nextgen.yaml,bin/configs/ruby-nextgen-qdrant.yaml) are unaffected. - Mention Ruby technical committee members: @cliffano @zlx @autopp @n-rodriguez
Summary by cubic
Fixes #24998. Sanitizes literal path segments in ruby-nextgen route derivation so embedded {param} placeholders and punctuation no longer produce invalid Ruby method names (e.g. export.csv became export/csv). Now strips placeholders and replaces non-identifier characters with underscores before deriving the action name.