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
  • #2067
Closed
Open
Issue created Feb 06, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] String interpolation in Ruby client code dose not work

Created by: autopp

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The interpolation in the error message of Ruby's client dose not work.

Swagger-codegen version
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar version
4.0.0-SNAPSHOT

$ git log --oneline -n 1
0b66fa5c82 (HEAD -> master, origin/master, origin/HEAD) add servers to path, operation (#2048)
Swagger declaration file content or url

https://gist.github.com/autopp/5a7375cd9b521b5e5580ba3b1df40c75

The point to notice in this example contains enum in the model.

Command line used for generation
$ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i 'https://gist.githubusercontent.com/autopp/5a7375cd9b521b5e5580ba3b1df40c75/raw/ca1d5eccce457c7337922b4a6a74f002848e4b4c/swagger.yml' -l ruby -o /tmp/gem
Steps to reproduce
  • Run the above command to generate client code for Ruby.
  • Generated /tmp/gem/lib/openapi_client/models/x.rb contains string interpolation notation in single-quote string. (It dose not work!)
    def y=(y)
      validator = EnumAttributeValidator.new('String', ['a'])
      unless validator.valid?(y)
        fail ArgumentError, 'invalid value for "y", must be one of #{validator.allowable_values}.' # <= HERE!
      end
      @y = y
    end
Related issues/PRs
Suggest a fix/enhancement

The corresponding template is this.

I think that it should be a double-quote string.

Assignee
Assign to
Time tracking