openapi_first 2.2.1 → 2.2.2

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: 9458fb5b815dcc64722a1829dc2082f60a92b36ce7af9fa8529c041544b190d4
4
- data.tar.gz: 5f5982e1e71f5f1a150860be23291863ff3c431b3bce332899b01150e2c9fc11
3
+ metadata.gz: de3cced92ef56a41399e4baa7aaf2b42250d2d3e532a22b245edd70d2b7446d2
4
+ data.tar.gz: b433a7d18c02176dda8ce12ff41636d4f19bd99632cbc0085879e34b3090cb76
5
5
  SHA512:
6
- metadata.gz: c92c5cbda9bcd884299a265fcc713c0370e0766670e2b3199af9169dfe29855ed78ae5ad1a70fd98326a4f764403e0b9429132b97ee9f3b887d5d9af772acd69
7
- data.tar.gz: '05083e92a954621b54667d8f99c133b2489e70eaa2b7332885c867053c81667a0eba0779ad210c150c8402814dff6d144044349271e8fe06808bafe0e5ad94ca'
6
+ metadata.gz: 58613cfd3648073dee3189cfced111adcdfd4471ee67a07517d3c800c69aded0ab46b50a69d56fda453a2af9078db74ee45c260c601c16cdd2896428d330068b
7
+ data.tar.gz: ae57aa8b109569165e9bb9ce3e9eb380e387a0eb1afb3cde850f7a2d3979391dc62ebe567cacb51492aefe4d9ef2db2db8963c4ca2b256cbf0c5b3e9491a2de3
data/CHANGELOG.md CHANGED
@@ -2,10 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.2.2
6
+
7
+ - Fix parsing parameters with referenced schemas (https://github.com/ahx/openapi_first/issues/316)
8
+
5
9
  ## 2.2.1
6
10
 
7
11
  - Fix issue with $ref resolving paths poiting outside directories `$ref: '../a/b.yaml'` (https://github.com/ahx/openapi_first/issues/313)
8
- - Remove warning about missing assertions when using assert_api_conform (https://github.com/ahx/openapi_first/issues/313)
12
+ - Remove warning about missing assertions when using assert_api_conform ([https://github.com/ahx/openapi_first/issues/313](https://github.com/ahx/openapi_first/issues/312))
9
13
 
10
14
  ## 2.2.0
11
15
 
@@ -47,10 +47,11 @@ module OpenapiFirst
47
47
  def router # rubocop:disable Metrics/MethodLength
48
48
  router = OpenapiFirst::Router.new
49
49
  @contents.fetch('paths').each do |path, path_item_object|
50
+ path_parameters = resolve_parameters(path_item_object['parameters'])
50
51
  path_item_object.resolved.keys.intersection(REQUEST_METHODS).map do |request_method|
51
52
  operation_object = path_item_object[request_method]
52
- parameters = operation_object['parameters']&.resolved.to_a.chain(path_item_object['parameters']&.resolved.to_a)
53
- parameters = parse_parameters(parameters)
53
+ operation_parameters = resolve_parameters(operation_object['parameters'])
54
+ parameters = parse_parameters(operation_parameters.chain(path_parameters))
54
55
 
55
56
  build_requests(path:, request_method:, operation_object:,
56
57
  parameters:).each do |request|
@@ -89,6 +90,14 @@ module OpenapiFirst
89
90
  )
90
91
  end
91
92
 
93
+ def resolve_parameters(parameters)
94
+ parameters&.map do |parameter|
95
+ result = parameter.resolved
96
+ result['schema'] = parameter['schema'].resolved
97
+ result
98
+ end.to_a
99
+ end
100
+
92
101
  def build_parameter_schema(parameters)
93
102
  schema = build_parameters_schema(parameters)
94
103
 
@@ -118,6 +118,7 @@ module OpenapiFirst
118
118
 
119
119
  # @visibility private
120
120
  class Array
121
+ include Enumerable
121
122
  include Resolvable
122
123
  include Diggable
123
124
 
@@ -128,6 +129,12 @@ module OpenapiFirst
128
129
  RefResolver.for(item, dir:, context:)
129
130
  end
130
131
 
132
+ def each
133
+ resolved.each do |item|
134
+ yield RefResolver.for(item, dir:, context:)
135
+ end
136
+ end
137
+
131
138
  def resolved
132
139
  value.map do |item|
133
140
  if item.respond_to?(:key?) && item.key?('$ref')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '2.2.1'
4
+ VERSION = '2.2.2'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_first
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-16 00:00:00.000000000 Z
10
+ date: 2025-01-21 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: hana