swagger-api / swagger-api/swagger-codegen-generators

Ruby client tests don't pass

Open
#855 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

There are some issues with the generated Rudy specs.

Steps to reproduce

brew install swagger-codegen
swagger-codegen generate -i https://petstore.swagger.io/v2/swagger.json -l ruby -o client
cd client
bundle install
rspec

Error

An error occurred while loading ./spec/base_object_spec.rb.
Failure/Error:
  class ArrayMapObject < Petstore::Category
    attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr

    def self.attribute_map
      {
        :int_arr => :int_arr,
        :pet_arr => :pet_arr,
        :int_map => :int_map,
        :pet_map => :pet_map,
        :int_arr_map => :int_arr_map,

NameError:
  uninitialized constant Petstore
# ./spec/base_object_spec.rb:3:in `<top (required)>'


Finished in 0.00004 seconds (files took 0.50225 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

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

Generate the Ruby client with the documented swagger-codegen command, install its bundle, and run rspec to reproduce the failure in spec/base_object_spec.rb. Trace why the generated spec cannot resolve Petstore, then verify that the complete Ruby client test suite loads and runs without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.