Skip to content

Commit b57ca76

Browse files
committed
fix for array in examples
1 parent e3e7a45 commit b57ca76

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/open_api_import.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
389389
end
390390

391391
#todo: consider check default and insert it
392-
if dpv.key?(:type)
392+
#todo: remove array from here and add the option to get_examples for the case thisisthekey: ['xxxx']
393+
if dpv.key?(:type) and dpv[:type]!='array'
393394
params_data << get_examples({dpk => dpv}, :only_value, true).join
394395
params_data[-1].chop!.chop! if params_data[-1].to_s[-2..-1]==', '
395396
params_data.pop if params_data[-1].match?(/^\s*$/im)
@@ -400,7 +401,6 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
400401
params_data << "#{dpk}: #{valv}"
401402
end
402403
}
403-
404404
if params_data.size > 0
405405
if data_examples_all_of == true and data_examples.size > 0
406406
data_examples[0]+=params_data

open_api_import.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'open_api_import'
3-
s.version = '0.10.5'
3+
s.version = '0.10.6'
44
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"
55
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"
66
s.authors = ["Mario Ruiz"]

0 commit comments

Comments
 (0)