oas_parser 0.19.0 → 0.20.0

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: 825c569ee33db4ed6f8b1e666b9bbba45a5440d34d3490074e63f5815414efd8
4
- data.tar.gz: 289f26572fa6abbf927305aaba1452d1c15ca6639726bf29768ec5ad12b490ef
3
+ metadata.gz: 76538bff6c3f4e9fd3ea31b6c2d365a55f7ae1db7a71f5d22cf6e19a2aa0456b
4
+ data.tar.gz: '0855e16c2b41697b079dfab75a1523a64ef5491d1f2f0a071ad43c810465dfb1'
5
5
  SHA512:
6
- metadata.gz: ff8b3c7bcedfd51b38de3a61b0781ea8f64af25238918091b83304c549331aec97ec9714c7daa5c481e37867adb1306529460406e66b21e33fc987772d2b81d8
7
- data.tar.gz: 35fe373a593e01a8b26fa8a1e04f0dbc388a6d87475c6523254a54a5de5883adb7ca65c5cc28f566c6c641f5e7a98c21aa9bf0e5db356b561043d875c0efba69
6
+ metadata.gz: ccf0cccc79a10d749e18646a7dd0b64889209f60f2edc67647bd6706e604d8373955867e3d198842f6fb8dc50b0131656c3f0f17e02a62674a1223592a808bc7
7
+ data.tar.gz: 81f6f36dff3902db4fcfaef359b0f18c592cd7608c52f998ac4ec87a9edd8cedd608334e75e6800418da6a4fed09867d9ed7bc79b2732f77185f11327aa2bf0b
@@ -0,0 +1,7 @@
1
+ ## 0.20.0
2
+
3
+ - allOf values are now deep-merged in to a single hash before being processed as properties/oneOf. This means that allOf will never be present in your data (just like JSON pointers are auto-resolved)
4
+
5
+ ## 0.19.0
6
+
7
+ - Parser now handles circular/self reference by returning the $ref as is instead of expanding it indefinitely. (Qihuan Piao)
@@ -6,19 +6,21 @@ PATH
6
6
  addressable (~> 2.3)
7
7
  builder (~> 3.2.3)
8
8
  deep_merge (~> 1.2.1)
9
+ hash-deep-merge
9
10
  mustermann-contrib (~> 1.0.3s)
10
11
  nokogiri
11
12
 
12
13
  GEM
13
14
  remote: https://rubygems.org/
14
15
  specs:
15
- activesupport (5.2.3)
16
+ activesupport (6.0.0)
16
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
18
  i18n (>= 0.7, < 2)
18
19
  minitest (~> 5.1)
19
20
  tzinfo (~> 1.1)
20
- addressable (2.6.0)
21
- public_suffix (>= 2.0.2, < 4.0)
21
+ zeitwerk (~> 2.1, >= 2.1.8)
22
+ addressable (2.7.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
22
24
  builder (3.2.3)
23
25
  coderay (1.1.2)
24
26
  concurrent-ruby (1.1.5)
@@ -42,6 +44,7 @@ GEM
42
44
  guard-compat (~> 1.1)
43
45
  rspec (>= 2.99.0, < 4.0)
44
46
  hansi (0.2.0)
47
+ hash-deep-merge (0.1.1)
45
48
  i18n (1.6.0)
46
49
  concurrent-ruby (~> 1.0)
47
50
  json (2.1.0)
@@ -58,7 +61,7 @@ GEM
58
61
  hansi (~> 0.2.0)
59
62
  mustermann (= 1.0.3)
60
63
  nenv (0.3.0)
61
- nokogiri (1.10.1)
64
+ nokogiri (1.10.4)
62
65
  mini_portile2 (~> 2.4.0)
63
66
  notiffany (0.1.1)
64
67
  nenv (~> 0.1)
@@ -66,7 +69,7 @@ GEM
66
69
  pry (0.11.3)
67
70
  coderay (~> 1.1.0)
68
71
  method_source (~> 0.9.0)
69
- public_suffix (3.0.3)
72
+ public_suffix (4.0.1)
70
73
  rake (10.5.0)
71
74
  rb-fsevent (0.10.3)
72
75
  rb-inotify (0.9.10)
@@ -97,6 +100,7 @@ GEM
97
100
  thread_safe (0.3.6)
98
101
  tzinfo (1.2.5)
99
102
  thread_safe (~> 0.1)
103
+ zeitwerk (2.1.9)
100
104
 
101
105
  PLATFORMS
102
106
  ruby
@@ -20,6 +20,10 @@ module OasParser
20
20
  raw['enum'] || (schema ? schema['enum'] : nil)
21
21
  end
22
22
 
23
+ def allOf?
24
+ raw['allOf'] ? true : false
25
+ end
26
+
23
27
  def oneOf?
24
28
  raw['oneOf'] ? true : false
25
29
  end
@@ -44,7 +48,7 @@ module OasParser
44
48
  end
45
49
 
46
50
  def properties
47
- return convert_property_schema_to_properties(raw) if oneOf?
51
+ return convert_property_schema_to_properties(raw) if (oneOf? || allOf?)
48
52
  return nil unless collection?
49
53
  return [] if empty?
50
54
  return convert_property_schema_to_properties(raw['properties']) if object?
@@ -20,6 +20,14 @@ module OasParser
20
20
  end
21
21
 
22
22
  def convert_property_schema_to_properties(schema)
23
+ if schema['allOf']
24
+ schema['properties'] = {}
25
+ schema['allOf'].each do |p|
26
+ schema['properties'].deep_merge!(p['properties'])
27
+ end
28
+ schema.delete('allOf')
29
+ end
30
+
23
31
  if schema['oneOf']
24
32
  schema['oneOf'].map do |subschema|
25
33
  subschema['properties'] = convert_property_schema_to_properties(subschema)
@@ -1,3 +1,3 @@
1
1
  module OasParser
2
- VERSION = '0.19.0'.freeze
2
+ VERSION = '0.20.0'.freeze
3
3
  end
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "builder", "~> 3.2.3"
27
27
  spec.add_dependency "mustermann-contrib", "~> 1.0.3s"
28
28
  spec.add_dependency "nokogiri"
29
+ spec.add_dependency "hash-deep-merge"
29
30
 
30
31
  spec.add_development_dependency "bundler", "~> 1.16"
31
32
  spec.add_development_dependency "guard-rspec", "~> 4.7.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Butler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-19 00:00:00.000000000 Z
11
+ date: 2019-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: hash-deep-merge
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +216,7 @@ files:
202
216
  - ".gitignore"
203
217
  - ".rspec"
204
218
  - ".travis.yml"
219
+ - CHANGELOG.md
205
220
  - CODE_OF_CONDUCT.md
206
221
  - Gemfile
207
222
  - Gemfile.lock
@@ -212,7 +227,6 @@ files:
212
227
  - bin/console
213
228
  - bin/setup
214
229
  - lib/oas_parser.rb
215
- - lib/oas_parser/CHANGELOG.md
216
230
  - lib/oas_parser/abstract_attribute.rb
217
231
  - lib/oas_parser/callback.rb
218
232
  - lib/oas_parser/definition.rb
@@ -249,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0'
251
265
  requirements: []
252
- rubyforge_project:
253
- rubygems_version: 2.7.6.2
266
+ rubygems_version: 3.0.1
254
267
  signing_key:
255
268
  specification_version: 4
256
269
  summary: A parser for Open API specifications
@@ -1,3 +0,0 @@
1
- ## Unreleased
2
-
3
- - Parser now handles circular/self reference by returning the $ref as is instead of expanding it indefinitely. (Qihuan Piao)