openapi3_parser 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9c582d931f4f1353ee60c24d7197af410b6a0fe
4
- data.tar.gz: 99f57e7b4ed9c359a769dbaff78a82bdeac13e55
3
+ metadata.gz: ca568bd4f56414a9a7467ba929750fe26ebe2ff6
4
+ data.tar.gz: 3e0a2532c02e114140e3ea53458e637308b1ab53
5
5
  SHA512:
6
- metadata.gz: 880d452e266f6dae6c14083ce278f21f469843e2952e0df3f3a5a11222fe0c9bb2042a2d5a0d7209eab83249556fb01f708bf2ffa624ac7838270199efaeb8a6
7
- data.tar.gz: 0c4980179959a775d12d913dec31896307e9712ef2ea3585eeba71f2e9fd6bd1ebbaafa90c0b00b1e5fd61967b83131f7e2773a9a7bd0e481e47b5c4922343c2
6
+ metadata.gz: 916678f780b8d71fd83c09a64fc6725e678dd8356a137d4b7295c7c4ca185d824c4803bae74c46de755faa5c52736ddcbada93fc0c88ef12d8b2e0e583edc56a
7
+ data.tar.gz: effde9d9458daf6d68bc5c9d79d137c32d583246f620f039b4606f1cf678d6f10bea2553a23b0930b2b73ecb0a665a66c9f5ac227e15956629095746363d634e
@@ -1,3 +1,8 @@
1
+ # 0.6.1
2
+
3
+ - Fix bug where Node::Object and Node::Map iterated arrays rather than hashes
4
+ on #each and other Enumerable methods
5
+
1
6
  # 0.6.0
2
7
 
3
8
  - Drop support for Ruby 2.3
@@ -28,8 +28,11 @@ module Openapi3Parser
28
28
  Placeholder.resolve(node_data[index])
29
29
  end
30
30
 
31
- def each
32
- node_data.each_index { |index| yield(self[index]) }
31
+ # Iterates through the data of this node, used by Enumerable
32
+ #
33
+ # @return [Object]
34
+ def each(&block)
35
+ Placeholder.each(node_data, &block)
33
36
  end
34
37
 
35
38
  # Used to access a node relative to this node
@@ -48,8 +48,11 @@ module Openapi3Parser
48
48
  self["x-#{value}"]
49
49
  end
50
50
 
51
- def each
52
- node_data.each_key { |key| yield(self[key]) }
51
+ # Iterates through the data of this node, used by Enumerable
52
+ #
53
+ # @return [Object]
54
+ def each(&block)
55
+ Placeholder.each(node_data, &block)
53
56
  end
54
57
 
55
58
  # Used to access a node relative to this node
@@ -48,8 +48,11 @@ module Openapi3Parser
48
48
  self["x-#{value}"]
49
49
  end
50
50
 
51
- def each
52
- node_data.each_key { |key| yield(self[key]) }
51
+ # Iterates through the data of this node, used by Enumerable
52
+ #
53
+ # @return [Object]
54
+ def each(&block)
55
+ Placeholder.each(node_data, &block)
53
56
  end
54
57
 
55
58
  # Used to render fields that can be in markdown syntax into HTML
@@ -42,7 +42,7 @@ module Openapi3Parser
42
42
  self["tags"]
43
43
  end
44
44
 
45
- # @return [ExternalDocumentation]
45
+ # @return [ExternalDocumentation, nil]
46
46
  def external_docs
47
47
  self["externalDocs"]
48
48
  end
@@ -11,6 +11,22 @@ module Openapi3Parser
11
11
  end
12
12
  end
13
13
 
14
+ # Used to iterate through hashes or arrays that may contain
15
+ # Placeholder objects where these are resolved to being nodes
16
+ # befor iteration
17
+ def self.each(node_data, &block)
18
+ resolved =
19
+ if node_data.respond_to?(:keys)
20
+ node_data.each_with_object({}) do |(key, value), memo|
21
+ memo[key] = resolve(value)
22
+ end
23
+ else
24
+ node_data.map { |item| resolve(item) }
25
+ end
26
+
27
+ resolved.each(&block)
28
+ end
29
+
14
30
  def initialize(node_factory, field, parent_context)
15
31
  @node_factory = node_factory
16
32
  @field = field
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Openapi3Parser
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi3_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Dew
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-07 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonmarker