Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
5 of 6 tasks
autopp opened this issue Feb 6, 2019 · 1 comment
Closed
5 of 6 tasks

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

autopp opened this issue Feb 6, 2019 · 1 comment

Comments

@autopp
Copy link
Contributor

autopp commented Feb 6, 2019

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.

@auto-labeler
Copy link

auto-labeler bot commented Feb 6, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant