Fix #25724: guard pattern validation against non-String values in ruby-nextgen

IN
1d ago
+55-3

Fixes #25724

Validations#validate_attribute checked patterns with value !~ rules[:pattern] without a type guard; Object#=~ was removed in Ruby 3.2, so a non-String value in a pattern-constrained attribute raised NoMethodError from new/valid? instead of being reported invalid.

The guard is now rules[:pattern] && (!value.is_a?(String) || value !~ rules[:pattern]) — non-String values are reported invalid with the standard message, matching the issue's expected output.

Generator test + spec fixture assert the guarded line and pattern: emission; ruby-nextgen petstore/qdrant samples regenerated (one line each). RubyNextgenClientCodegenTest 25/25 green; negative check confirmed the test fails without the guard.


Summary by cubic

Prevents ruby-nextgen pattern validation from raising NoMethodError when a constrained attribute contains a non-String value. Such values are now reported invalid with the standard validation message.

  • Adds a generator test and fixture for pattern validation.
  • Regenerates the Petstore and Qdrant validation samples.