openapi_parser 0.14.0 → 0.14.1

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: b1b06e3e4d6ad28828a02c2a4a79140439b9119ac53b73494318386195cc6275
4
- data.tar.gz: 4360946a10aa364d8c0de18d773eee3df2ee683373de2178307f52530806e81a
3
+ metadata.gz: af992ada1b5830b3d4cbc00e0ccaf5a852689a744af4d239887b3dc5c8be27ec
4
+ data.tar.gz: adbd6263d7f27fecf43da5881d8c06e5bf23307c94271e2b0d7fe86aa5e0c402
5
5
  SHA512:
6
- metadata.gz: be2a98609d41e4207edff4aaa61687b34dc568cb36e38b37eef42c7edffc836ffb9110465dda772c41025bc0fce125115da370e36949414ceb8902051c81b7b8
7
- data.tar.gz: 3047ab4d4ef9f465e9c9373567c11e323ecd135d994002d8578426bdc38d5cdbe5922050d66bdf701551fb10fcb3206029276b49a33e2bc1d755278cb105a9e3
6
+ metadata.gz: c14c69ad8074807efdc4a3016cfec14fc62635c893c28839089531ad91239b41ad418fc182e32252eebaca02d4a38286c58e81fa1a0be5b43190301601edf2e4
7
+ data.tar.gz: ebd2d353112df3ac9a5a013b6ee4a7a53ea2b9817a6f46653ee619959d667bcbd6591e763ffcd0075f55b3db373a4e515ca84949275efbedf2fb8dcbfab809b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.14.1 (2021-07-9)
4
+ ### Fixed
5
+ * Fix bug for using path parameter and coerce option #115
6
+
3
7
  ## 0.14.0 (2021-05-24)
4
8
 
5
9
  ### Added
@@ -93,6 +93,11 @@ module OpenAPIParser
93
93
 
94
94
  OpenAPIParser::ReferenceExpander.expand(root) if config.expand_reference
95
95
 
96
+ # TODO: use callbacks
97
+ root.paths&.path&.values&.each do | path_item |
98
+ path_item.set_path_item_to_operation
99
+ end
100
+
96
101
  root
97
102
  end
98
103
  end
@@ -13,6 +13,12 @@ module OpenAPIParser::ParameterValidatable
13
13
  validate_query_parameter(params, object_reference, options)
14
14
  end
15
15
 
16
+ # @param [PathItem] path_item parent
17
+ def set_parent_path_item(path_item)
18
+ @merged_parameter = (parameters || []) + (path_item.parameters || [])
19
+ nil
20
+ end
21
+
16
22
  private
17
23
 
18
24
  # @param [Hash] params query parameter hash
@@ -44,7 +50,7 @@ module OpenAPIParser::ParameterValidatable
44
50
  # @return [Hash{String => Hash{String => Parameter}}] hash[in][name] => Parameter
45
51
  def divided_parameter_hash
46
52
  @divided_parameter_hash ||=
47
- (parameters || []).
53
+ (@merged_parameter || []).
48
54
  group_by(&:in).
49
55
  map { |in_type, params| # rubocop:disable Style/BlockDelimiters
50
56
  [
@@ -65,7 +65,6 @@ class OpenAPIParser::RequestOperation
65
65
  # @param [OpenAPIParser::SchemaValidator::Options] options request validator options
66
66
  def validate_request_parameter(params, headers, options = nil)
67
67
  options ||= config.request_validator_options
68
- path_item&.validate_request_parameter(params, headers, options)
69
68
  operation_object&.validate_request_parameter(params, headers, options)
70
69
  end
71
70
 
@@ -3,8 +3,6 @@
3
3
 
4
4
  module OpenAPIParser::Schemas
5
5
  class PathItem < Base
6
- include OpenAPIParser::ParameterValidatable
7
-
8
6
  openapi_attr_values :summary, :description
9
7
 
10
8
  openapi_attr_objects :get, :put, :post, :delete, :options, :head, :patch, :trace, Operation
@@ -16,5 +14,9 @@ module OpenAPIParser::Schemas
16
14
  rescue NoMethodError
17
15
  nil
18
16
  end
17
+
18
+ def set_path_item_to_operation
19
+ [:get, :put, :post, :delete, :options, :head, :patch, :trace].each{ |method| operation(method)&.set_parent_path_item(self)}
20
+ end
19
21
  end
20
22
  end
@@ -1,3 +1,3 @@
1
1
  module OpenAPIParser
2
- VERSION = '0.14.0'.freeze
2
+ VERSION = '0.14.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ota42y
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-12 00:00:00.000000000 Z
11
+ date: 2021-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler