openapi3_parser 0.9.0 → 0.9.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
  SHA256:
3
- metadata.gz: 81001258de6af8c21c8a7db87520d9433e3acb878483a56a616fdcd804e92848
4
- data.tar.gz: 496f3a02ebcb386e949eab7ec6607f360a0b2e755be6bb4f1df3cd6b260a6e0d
3
+ metadata.gz: 5904884ad75e5d50acec8b37e27d4888ee903adab23998a78f884b4595e271dc
4
+ data.tar.gz: 8af9725d24ae912bac01b9be995be1d0105801cd245b7698508bb840b7e6da6a
5
5
  SHA512:
6
- metadata.gz: d789d4ffe423f8854f961e902ffa6ef56b86d7dbcf506292106afa8548b72f2fbe968d98358ea7c80771a3c2e974c302096d43968c0663bdad40dc5f60a676e2
7
- data.tar.gz: aea92fa77fbb4808872093b9149f8eb933f70a38336a0e415fa1fc9d4c15e691b8307abb0d70c0e51eee8eca89887cbc1a16b21e70f2d1812ae0fd77b75fe2a3
6
+ metadata.gz: 4edb5b8d4eec5c510ba62f58a2fb99b5156271548183d4dbc14039d17a0f14c504f466c359543cd871f8530d520e144ec03db1782fb8bcf6c006efb1434c6b45
7
+ data.tar.gz: 48f873eb9a0731fb8918b2015cb5263db8b9aeb0c6c24fe4e03e4d0d2be752f728efdecbff08064db915278e6862ad98f77259ed5a7d723e0f9c31cfd82debea
@@ -3,7 +3,7 @@ jobs:
3
3
  test:
4
4
  strategy:
5
5
  matrix:
6
- ruby: [2.5, 2.6, 2.7, 3.0]
6
+ ruby: [2.6, 2.7, 3.0, 3.1]
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - uses: actions/checkout@v2
@@ -13,11 +13,11 @@ jobs:
13
13
  ruby-version: ${{ matrix.ruby }}
14
14
  - name: Test Ruby ${{ matrix.ruby }}
15
15
  run: bundle exec rake
16
- if: matrix.ruby != '2.5'
16
+ if: matrix.ruby != '2.6'
17
17
  - name: Test and publish coverage for Ruby ${{ matrix.ruby }}
18
18
  uses: paambaati/codeclimate-action@v2.7.5
19
19
  env:
20
20
  CC_TEST_REPORTER_ID: 8bc2d8e54331569aeb442094c21cb64a58d6efa0670f65ff00d9ae887f63c0b4
21
21
  with:
22
22
  coverageCommand: bundle exec rake
23
- if: matrix.ruby == '2.5'
23
+ if: matrix.ruby == '2.6'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
1
+ 2.6.9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.9.1
2
+
3
+ - Fix Schema#requires? incorrectly returning true for referenced properties -
4
+ https://github.com/kevindew/openapi3_parser/issues/20
5
+ - Drop support for Ruby 2.5
6
+
1
7
  # 0.9.0
2
8
 
3
9
  - Fix unexpected fields error when using Example nodes inside a Parameter -
data/README.md CHANGED
@@ -121,7 +121,7 @@ You can install this gem into your bundler application by adding this line to
121
121
  your Gemfile:
122
122
 
123
123
  ```
124
- gem "openapi3_parser", "~> 0.8.0"
124
+ gem "openapi3_parser", "~> 0.9.0"
125
125
  ```
126
126
 
127
127
  and then running `$ bundle install`
@@ -120,9 +120,11 @@ module Openapi3Parser
120
120
  # @return [Boolean]
121
121
  def requires?(property)
122
122
  if property.is_a?(Schema)
123
+ # compare node_context of objects to ensure references aren't treated
124
+ # as equal - only direct properties of this object will pass.
123
125
  properties.to_h
124
126
  .select { |k, _| required.to_a.include?(k) }
125
- .any? { |_, schema| schema == property }
127
+ .any? { |_, schema| schema.node_context == property.node_context }
126
128
  else
127
129
  required.to_a.include?(property)
128
130
  end
@@ -68,7 +68,7 @@ module Openapi3Parser
68
68
 
69
69
  def merge_data(base, priority)
70
70
  base.merge(priority) do |_, old, new|
71
- if new.nil? || new.respond_to?(:nil_input?) && new.nil_input?
71
+ if new.nil? || (new.respond_to?(:nil_input?) && new.nil_input?)
72
72
  old
73
73
  else
74
74
  new
@@ -36,9 +36,7 @@ module Openapi3Parser
36
36
  end
37
37
 
38
38
  def validate(validatable)
39
- paths = validatable.input.keys.reject do |key|
40
- NodeFactory::EXTENSION_REGEX =~ key
41
- end
39
+ paths = validatable.input.keys.grep_v(NodeFactory::EXTENSION_REGEX)
42
40
  validate_paths(validatable, paths)
43
41
  end
44
42
 
@@ -8,7 +8,7 @@ module Openapi3Parser
8
8
  # provide common means to convert it into different representations.
9
9
  class Pointer
10
10
  def self.from_fragment(fragment)
11
- fragment = fragment[1..-1] if fragment.start_with?("#")
11
+ fragment = fragment[1..] if fragment.start_with?("#")
12
12
  absolute = fragment[0] == "/"
13
13
  segments = fragment.split("/").map do |part|
14
14
  next if part == ""
@@ -93,7 +93,7 @@ module Openapi3Parser
93
93
 
94
94
  joined = File.expand_path("/#{fragment_a}/#{fragment_b}", "/")
95
95
 
96
- joined = joined[1..-1] unless pointer_a.absolute
96
+ joined = joined[1..] unless pointer_a.absolute
97
97
 
98
98
  Pointer.from_fragment("##{joined}")
99
99
  end
@@ -29,13 +29,9 @@ module Openapi3Parser
29
29
  end
30
30
 
31
31
  def factory
32
- @factory ||= begin
33
- reference_registry
34
- .factory(object_type, source_location)
35
- .tap do |factory|
36
- message = "Unregistered node factory at #{source_location}"
37
- raise Openapi3Parser::Error, message unless factory
38
- end
32
+ @factory ||= reference_registry.factory(object_type, source_location).tap do |factory|
33
+ message = "Unregistered node factory at #{source_location}"
34
+ raise Openapi3Parser::Error, message unless factory
39
35
  end
40
36
  end
41
37
 
@@ -39,7 +39,7 @@ module Openapi3Parser
39
39
  extra_keys = input.keys - allowed_fields
40
40
  return extra_keys unless allow_extensions
41
41
 
42
- extra_keys.reject { |key| key =~ NodeFactory::EXTENSION_REGEX }
42
+ extra_keys.grep_v(NodeFactory::EXTENSION_REGEX)
43
43
  end
44
44
  end
45
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Openapi3Parser
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.version = Openapi3Parser::VERSION
11
11
  spec.author = "Kevin Dew"
12
12
  spec.email = "kevindew@me.com"
13
+ spec.metadata = { "rubygems_mfa_required" => "true" }
13
14
 
14
15
  spec.summary = "An OpenAPI V3 parser for Ruby"
15
16
  spec.description = <<-DESCRIPTION
@@ -24,7 +25,7 @@ Gem::Specification.new do |spec|
24
25
  f.match(%r{^spec/})
25
26
  end
26
27
 
27
- spec.required_ruby_version = ">= 2.5.0"
28
+ spec.required_ruby_version = ">= 2.6.0"
28
29
 
29
30
  spec.add_dependency "commonmarker", "~> 0.17"
30
31
  spec.add_dependency "psych", "~> 3.1"
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.9.0
4
+ version: 0.9.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: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonmarker
@@ -300,7 +300,8 @@ files:
300
300
  homepage: https://github.com/kevindew/openapi_parser
301
301
  licenses:
302
302
  - MIT
303
- metadata: {}
303
+ metadata:
304
+ rubygems_mfa_required: 'true'
304
305
  post_install_message:
305
306
  rdoc_options: []
306
307
  require_paths:
@@ -309,15 +310,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
310
  requirements:
310
311
  - - ">="
311
312
  - !ruby/object:Gem::Version
312
- version: 2.5.0
313
+ version: 2.6.0
313
314
  required_rubygems_version: !ruby/object:Gem::Requirement
314
315
  requirements:
315
316
  - - ">="
316
317
  - !ruby/object:Gem::Version
317
318
  version: '0'
318
319
  requirements: []
319
- rubyforge_project:
320
- rubygems_version: 2.7.6.2
320
+ rubygems_version: 3.0.3.1
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: An OpenAPI V3 parser for Ruby