swagger-api / swagger-codegen-generators

Apache License 2.0
279 stars 418 forks source link

Ruby client tests don't pass #855

Open col opened 3 years ago

col commented 3 years ago

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
col commented 3 years ago

base_object_spec.mustache appears to have hardcoded references to the Petstore::Category which obviously isn't going to work unless you only ever generate the Pet Store schema. However even when generating that specific schema (and including the moduleName="Petstore") these specs still don't pass.