swagger-api / swagger-api/swagger-codegen

Ruby client: Array included in imports & import(require) statements are missing in models

Open
#2,373 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Ruby help wanted Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Hi @wing328,
I just came across model mustache for Ruby does not have require or require_relative as we have importstatements for Java in model mustache.
So I modified mustache to include require statements for imports, but I noticed that import mustache variable has Array as imports.
In Ruby, a seperate import statement is not required for Arrays as in Java. How can I skip Array import in mustache ? My model mustache has imports as below :

{{#imports}}require_relative '{{{import}}}'
{{/imports}}

My model.rb looks as below, having Java imports in ruby model :

require_relative 'java.util.List'

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 by locating the Ruby model mustache template and inspecting how its imports collection is rendered into model.rb. Verify how Array and other Java-style imports enter that collection; done means Ruby models use require or require_relative where needed without generating a require for Array or Java imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.