Bug Report Checklist
Description
When using pattern, the generated Ruby client code may contain an unexpected interpolation.
openapi-generator version
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar version
4.0.0-SNAPSHOT
$ git log --oneline -n 1
aa24f07433 (HEAD -> master, origin/master, origin/HEAD) [TypescriptAngular] gets package npm version from API specification (#2019)
OpenAPI declaration file content or url
See: https://gist.github.com/autopp/925901844b9c973fd3c86d06ea95c03a#file-swagger-yml
The point to notice in this example is that #{...} is included in the pattern.
Command line used for generation
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate --skip-validate-spec -g ruby -o /tmp/gem -i 'https://gist.githubusercontent.com/autopp/925901844b9c973fd3c86d06ea95c03a/raw/df474dc0331ee167d337a2cc7aadc49afdd7ee03/swagger.yml'
Steps to reproduce
- Run the above command to generate client code for Ruby.
lib/openapi_client/api/default_api.rb contains unexpected interpolation
def foo_get_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.foo_get ...'
end
if @api_client.config.client_side_validation && !opts[:'x'].nil? && opts[:'x'] !~ Regexp.new(/^injected code: #{injected.code}$/)
fail ArgumentError, "invalid value for 'opts[:\"x\"]' when calling DefaultApi.foo_get, must conform to the pattern /^injected code: #{injected.code}$/."
end
In this example, injected.code is executed when request to GET /foo (And error may occur).
Related issues/PRs
N/A
Suggest a fix
Curretly, RubyClientCodegen dose not override escapeText.
Should not this be overridden to accommodate Ruby's string literal characteristics?
Bug Report Checklist
Description
When using
pattern, the generated Ruby client code may contain an unexpected interpolation.openapi-generator version
OpenAPI declaration file content or url
See: https://gist.github.com/autopp/925901844b9c973fd3c86d06ea95c03a#file-swagger-yml
The point to notice in this example is that
#{...}is included in thepattern.Command line used for generation
Steps to reproduce
lib/openapi_client/api/default_api.rbcontains unexpected interpolationIn this example,
injected.codeis executed when request toGET /foo(And error may occur).Related issues/PRs
N/A
Suggest a fix
Curretly,
RubyClientCodegendose not overrideescapeText.Should not this be overridden to accommodate Ruby's string literal characteristics?