Skip to content

Commit

Permalink
fix for array in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRuiz committed Aug 7, 2020
1 parent e3e7a45 commit b57ca76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/open_api_import.rb
Expand Up @@ -389,7 +389,8 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
end

#todo: consider check default and insert it
if dpv.key?(:type)
#todo: remove array from here and add the option to get_examples for the case thisisthekey: ['xxxx']
if dpv.key?(:type) and dpv[:type]!='array'
params_data << get_examples({dpk => dpv}, :only_value, true).join
params_data[-1].chop!.chop! if params_data[-1].to_s[-2..-1]==', '
params_data.pop if params_data[-1].match?(/^\s*$/im)
Expand All @@ -400,7 +401,6 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
params_data << "#{dpk}: #{valv}"
end
}

if params_data.size > 0
if data_examples_all_of == true and data_examples.size > 0
data_examples[0]+=params_data
Expand Down
2 changes: 1 addition & 1 deletion open_api_import.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'open_api_import'
s.version = '0.10.5'
s.version = '0.10.6'
s.summary = "OpenApiImport -- Import a Swagger or Open API file and create a Ruby Request Hash file including all requests and responses with all the examples. The file can be in JSON or YAML"
s.description = "OpenApiImport -- Import a Swagger or Open API file and create a Ruby Request Hash file including all requests and responses with all the examples. The file can be in JSON or YAML"
s.authors = ["Mario Ruiz"]
Expand Down

0 comments on commit b57ca76

Please sign in to comment.