OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Ruby] `samples/client/petstore-security-test/ruby` contains syntax errors

Open
#2,155 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

Generated Ruby client code in samples/client/petstore-security-test/ruby contains syntax errors.

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

$ git log --oneline -n 1
b6c2266a14 (HEAD -> master, origin/master, origin/HEAD) [Rust][Client] Code format (#2042)
OpenAPI declaration file content or url

N/A

Command line used for generation
$ cd samples/client/petstore-security-test/ruby
$ rubocop
Steps to reproduce
  1. Run the above command to check syntax of samples.
  2. Get errors:
    $ rubocop -f s
    == lib/petstore/configuration.rb ==
    E:220: 46: Lint/Syntax: unexpected token tEQL
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    E:220: 54: Lint/Syntax: bare backslash only allowed before newline
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    E:220: 56: Lint/Syntax: bare backslash only allowed before newline
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    E:220: 59: Lint/Syntax: bare backslash only allowed before newline
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    E:220: 62: Lint/Syntax: bare backslash only allowed before newline
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    W:220: 68: Lint/Syntax: *' interpreted as argument prefix
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops`)
    F:220: 69: Lint/Syntax: unterminated string meets end of file
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
    
    15 files inspected, 7 offenses detected
    
Related issues/PRs

#2101

Suggest a fix

The cause is here.
I think that the embedded URL must be escaped.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with samples/client/petstore-security-test/ruby/lib/petstore/configuration.rb at the reported line 220 and review related issue #2101. Run rubocop in samples/client/petstore-security-test/ruby to reproduce the syntax errors. Done means the generated Ruby sample passes the syntax checks without the reported offenses.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.