Skip to content

Commit 3d18972

Browse files
committed
avoid duplicated keys on data_pattern
1 parent 625410f commit 3d18972

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/open_api_import.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,17 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
374374

375375
data_pattern += get_patterns(dpk,dpv)
376376
data_pattern.uniq!
377+
dpkeys = []
378+
data_pattern.reject! do |dp|
379+
dpkey = dp.scan(/^'\w+'/)
380+
381+
if dpkeys.include?(dpkey)
382+
true
383+
else
384+
dpkeys << dpkey
385+
false
386+
end
387+
end
377388

378389
if dpv.keys.include?(:readOnly) and dpv[:readOnly] == true
379390
data_read_only << dpk

0 commit comments

Comments
 (0)