open_api_import 0.11.2 → 0.11.3

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: 2898c6734c8b0816229742064e145a6c3c48d8a4b4969c4cc4a032a7efaec90a
4
+ data.tar.gz: 2966b9d5e861f8857c964645d9b7089b43c08ae7cb564aff99ddae3a94025ec0
5
5
  SHA512:
6
- metadata.gz: ef3fb3ee1ada1afd408313b818eaceb7f16dd98a26a0b215004e2a3fba465d4731bed7bae7ead4edf8ed87c1d108b6fe3ff8220d4e289688344ad1172b2c9caa
7
- data.tar.gz: 88a71dbd1ac92bb4b9c73dbe9cf8c1146c5667d50cd43eb273afd5bb55e9c1ef1c75fac05ede6ef4b80199960c6b1646308bdcb08833e011ed9a63cca6907d9a
6
+ metadata.gz: f606dfb92494c7ceed2298c55f56b3666edeb2605af2e8b9f5876d450fbce214152a7efc3efe03423613533a15c4899406e2121f31992bd3689d90c85cdf5bdc
7
+ data.tar.gz: 16ae0345a060a5feabef4eaaae4d1eb7f11fb3a01decd58c59aaa020564812f8509999d56220bcc30f06168ae6556d7b4c9274a972719fe4b9491af0a67266fa
@@ -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
@@ -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.3
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-07-17 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
  - - ">="