Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • #2261
Something went wrong while setting issue due date.
Closed
Open
Issue created 6 years ago by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

[BUG] Generated Ruby client may contains unexpected interpolation when using enum

Closed

[BUG] Generated Ruby client may contains unexpected interpolation when using enum

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

When using enum, 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
54d9c19c77 (HEAD -> master, origin/master, origin/HEAD) Use https URL to download dependencies (#2248)
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 enum.

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/48160b45f1c17c950ba72feb971786c3/raw/974579f49d9a0eebff0455e54efce842eee64c9b/example.yml'
Steps to reproduce
  1. Run the above command to generate client code for Ruby.
  2. 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
      allowable_values = ["^injected code: #{injected.code}$"]

In this example, injected.code is executed when request to GET /foo (And error may occur).

Related issues/PRs

#2088 (closed)

Suggest a fix

(Same as #2088 (closed)) Curretly, RubyClientCodegen dose not override escapeText. Should not this be overridden to accommodate Ruby's string literal characteristics?

An error occurred while loading designs. Please try again.
Tasks
0
server returned results with length 5, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference:

Menu

Explore Projects Groups Snippets