Skip to content

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

Open
Inf1mum wants to merge 1 commit into
OpenAPITools:masterfrom
Inf1mum:fix/25724-pattern-guard
Open

Inf1mum wants to merge 1 commit into
OpenAPITools:masterfrom
Inf1mum:fix/25724-pattern-guard

Conversation

@Inf1mum

@Inf1mum Inf1mum commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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.

Written for commit 3378a50. Summary will update on new commits.

View guided diff

…alues in ruby-nextgen

Signed-off-by: Inf1mum <vadimlazuk5@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
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.

[BUG][RUBY-NEXTGEN] A non-String value in a pattern-constrained attribute raises NoMethodError

1 participant