open_api_import 0.11.2 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '086658ecb8430c46e04c59f9f7040083c5dd1599c5fc8538a021bdc6f0214d88'
4
- data.tar.gz: 1508d5c5c35a315dc13b4a4d71d4b4dba37ab56f96bbc409bf95ff980a4fe2f0
3
+ metadata.gz: 32504c2573c09e3df9caf4778bfa319c059678332fdb4d69b6fa13e6a513abe4
4
+ data.tar.gz: 5d544539027b41e96e5547b4bfcaafeeafaf3cf70f53f32b829408657d2680e9
5
5
  SHA512:
6
- metadata.gz: ef3fb3ee1ada1afd408313b818eaceb7f16dd98a26a0b215004e2a3fba465d4731bed7bae7ead4edf8ed87c1d108b6fe3ff8220d4e289688344ad1172b2c9caa
7
- data.tar.gz: 88a71dbd1ac92bb4b9c73dbe9cf8c1146c5667d50cd43eb273afd5bb55e9c1ef1c75fac05ede6ef4b80199960c6b1646308bdcb08833e011ed9a63cca6907d9a
6
+ metadata.gz: 4634722d29946110d790f18c1e5447d4c95c594c27a15c4d8ded80752c16ef396af17d192193515a4b374bbec70a5c8cd7f62bc9a5414edf397b37f223d44d62
7
+ data.tar.gz: 82581bab408477dae003894c43c981ad3cf44858d92c9617fb87d69152b579504b92a6fbd518da520774a3e15b394a5dc14e445f4416c654e9ed255c0160dad2
@@ -36,11 +36,11 @@ module LibOpenApiImport
36
36
  when "boolean"
37
37
  example << " #{prop.to_sym}: true, "
38
38
  when "array"
39
- if val.key?(:items) and val[:items].size == 1 and val[:items].is_a?(Hash) and val[:items].key?(:type)
39
+ if val.key?(:items) and val[:items].is_a?(Hash) and val[:items].size == 1 and val[:items].key?(:type)
40
40
  val[:items][:enum] = [val[:items][:type]]
41
41
  end
42
42
 
43
- if val.key?(:items) and val[:items].key?(:enum)
43
+ if val.key?(:items) and !val[:items].nil? and val[:items].key?(:enum)
44
44
  #before we were getting in all these cases a random value from the enum, now we are getting the first position by default
45
45
  #the reason is to avoid confusion later in case we want to compare two swaggers and verify the changes
46
46
  if type == :only_value
@@ -7,6 +7,8 @@ module LibOpenApiImport
7
7
  if dpv[:pattern].include?('\\\\/')
8
8
  #for cases like this: ^[^\.\\/:*?"<>|][^\\/:*?"<>|]{0,13}[^\.\\/:*?"<>|]?$
9
9
  data_pattern << "'#{dpk}': /#{dpv[:pattern].to_s.gsub('\/', "/")}/"
10
+ elsif dpv[:pattern].match?(/\\x[0-9ABCDEF][0-9ABCDEF]\-/)
11
+ data_pattern << "'#{dpk}': /#{dpv[:pattern].to_s.gsub('\\x', '\\u00')}/"
10
12
  elsif dpv[:pattern].include?('\\x')
11
13
  data_pattern << "'#{dpk}': /#{dpv[:pattern].to_s.gsub('\\x', '\\u')}/"
12
14
  else
@@ -60,8 +60,8 @@ module LibOpenApiImport
60
60
  end
61
61
  elsif v.key?(:schema) && v[:schema].is_a?(Hash) &&
62
62
  (v[:schema].key?(:properties) ||
63
- (v[:schema].key?(:items) && v[:schema][:items].key?(:properties)) ||
64
- (v[:schema].key?(:items) && v[:schema][:items].key?(:allOf)) ||
63
+ (v[:schema].key?(:items) && v[:schema][:items].is_a?(Hash) && v[:schema][:items].key?(:properties)) ||
64
+ (v[:schema].key?(:items) && v[:schema][:items].is_a?(Hash) && v[:schema][:items].key?(:allOf)) ||
65
65
  v[:schema].key?(:allOf))
66
66
  properties = {}
67
67
  if v[:schema].key?(:properties)
@@ -89,7 +89,7 @@ module LibOpenApiImport
89
89
  response_example << "]"
90
90
  end
91
91
  end
92
- elsif v.key?(:schema) and v[:schema].key?(:items) and v[:schema][:items].key?(:type)
92
+ elsif v.key?(:schema) and v[:schema].key?(:items) and v[:schema][:items].is_a?(Hash) and v[:schema][:items].key?(:type)
93
93
  # for the case only type supplied but nothing else for the array
94
94
  response_example << "[\"#{v[:schema][:items][:type]}\"]"
95
95
  end
@@ -52,12 +52,12 @@ class OpenApiImport
52
52
  begin
53
53
  definition = OasParser::Definition.resolve(swagger_file)
54
54
  rescue Exception => stack
55
- message = "There was a problem parsing the Open Api document using the oas_parser gem. The execution was aborted.\n"
56
- message += "Visit the github for oas_parser gem for bugs and more info: https://github.com/Nexmo/oas_parser\n"
55
+ message = "There was a problem parsing the Open Api document using the oas_parser_reborn gem. The execution was aborted.\n"
56
+ message += "Visit the github for oas_parser_reborn gem for bugs and more info: https://github.com/MarioRuiz/oas_parser_reborn\n"
57
57
  message += "Error: #{stack.message}"
58
58
  puts message
59
59
  @logger.fatal message
60
- @logger.fatal stack.backtrace
60
+ @logger.fatal stack.backtrace.join("\n")
61
61
  exit!
62
62
  end
63
63
 
@@ -10,7 +10,7 @@ require_relative "open_api_import/open_api_import"
10
10
 
11
11
  include LibOpenApiImport
12
12
 
13
- require "oas_parser"
13
+ require "oas_parser_reborn"
14
14
  require "rufo"
15
15
  require "nice_hash"
16
16
  require "logger"
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_api_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-30 00:00:00.000000000 Z
11
+ date: 2023-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: oas_parser
14
+ name: oas_parser_reborn
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: '2.6'
126
+ version: '2.7'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="