Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1392
Closed
Open
Issue created Nov 06, 2018 by Administrator@rootContributor

Regex param validation not working as expected in Ruby-Client

Created by: ggershoni

Description

We are using a \d in our regex to ensure pattern has only digits but this is turned into \d and Ruby can't interpret it correctly.

In OpenAPI v3 file: pattern: '^\d{10}$' Generated validation code: Regexp.new(/^\\d{10}$/) Should be: Regexp.new(/^\d{10}$/)

openapi-generator version

Was using latest stable version (3.3.2) and also grabbed and build latest from master.

OpenAPI declaration file content or url
Command line used for generation

docker run --rm -v ${PWD}:/local -v ${PWD}/../openapi/$(OPENAPI_FILENAME):/source/openapi-v3.yaml openapitools/openapi-generator-cli generate -i /source/openapi-v3.yaml -g ruby -o /local/out/ruby-client

Steps to reproduce

Following code is raising exception:

require 'openapi_client'

api_instance = OpenapiClient::AccountsApi.new
account_number = '1234567890'
account_number2 = '1234567891'
authentication = 'authentication_example'

result = api_instance.get_account_information(account_number, account_number2, authentication)
p result
Traceback (most recent call last):
	2: from get_account.rb:8:in `<main>'
	1: from /Users/guy/.gem/ruby/2.5.3/gems/openapi_client-1.0.0/lib/openapi_client/api/accounts_api.rb:29:in `get_account_information'
/Users/guy/.gem/ruby/2.5.3/gems/openapi_client-1.0.0/lib/openapi_client/api/accounts_api.rb:48:in `get_account_information_with_http_info': invalid value for 'account_number' when calling AccountsApi.get_account_information, must conform to the pattern /^\d{10}$/. (ArgumentError)
Related issues/PRs
Suggest a fix/enhancement

Have PR with fix.

Assignee
Assign to
Time tracking