rspec-openapi 0.18.1 → 0.18.2

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: 20d994264ab34877708e7c467c98b31f1b672ee0d73b953f2791e404895eed58
4
- data.tar.gz: 6c319639b445a9178919a435a7816d0dfb5d8156c71d0fe1f929ab76d4733086
3
+ metadata.gz: e9d5e7e261220ae8c790eff0702c0d5e08dbf53667a410a1a540bdb4557d5f55
4
+ data.tar.gz: ffd9b3d5cab09166652fb03d1a22cf774170c6e80690ed4215e3483b951d8f73
5
5
  SHA512:
6
- metadata.gz: c7526eb5af4a66264ad5874c9f3fb3c9dd964196a3d91d7e0739956443fc643646822038c90a707a9b9fb5e26bba9bccd5652973ef227f4c8dd961a440a4682e
7
- data.tar.gz: e3d71afaa32041ba31266832c51d4241e248cba2cb4b607adbd157b0164eedab4ef9d5e17ab89c7e196b52a64365aab584aa0dae1f5f0c0701f4dfde49f1f26c
6
+ metadata.gz: 007a4e0466e55fa656667eb498a0f27cd3b049dc8fb2d3a2b46b1b511fbe0f28fab3a79282577b0c5db08a55301576e8104013854fdf400884ab58d3312fba04
7
+ data.tar.gz: 39f0f78cfe88df09e7b16c540dc95890ac712feb7700df6f18101e5355540f21881f2905652c808422065f9330abfdd0c8f1037342192e5ee0b643fc71b65713
@@ -19,7 +19,10 @@ class Inspector
19
19
  def call(verb, path)
20
20
  route = routes.find { |r| r.http_method == verb && r.path == path }
21
21
 
22
- if route.to.is_a?(Proc)
22
+ if route.nil?
23
+ # FIXME: This is a hack to pass `/sites/***` in testing
24
+ {}
25
+ elsif route.to.is_a?(Proc)
23
26
  {
24
27
  tags: [],
25
28
  summary: "#{verb} #{path}",
@@ -44,32 +44,23 @@ class << RSpec::OpenAPI::Extractors::Rails = Object.new
44
44
 
45
45
  # @param [ActionDispatch::Request] request
46
46
  def find_rails_route(request, app: Rails.application, path_prefix: '')
47
- app.routes.router.recognize(request) do |route, parameters|
47
+ app.routes.router.recognize(request) do |route, _parameters|
48
48
  path = route.path.spec.to_s.delete_suffix('(.:format)')
49
49
 
50
50
  if route.app.matches?(request)
51
51
  if route.app.engine?
52
52
  route, path = find_rails_route(request, app: route.app.app, path_prefix: path)
53
53
  next if route.nil?
54
- elsif path_prefix + path == add_id(request.path, parameters)
55
- return [route, path_prefix + path]
56
- else
57
- return [route, nil]
58
54
  end
55
+
56
+ # Params are empty when it is Engine or Rack app.
57
+ # In that case, we can't handle parameters in path.
58
+ return [route, nil] if request.params.empty?
59
+
59
60
  return [route, path_prefix + path]
60
61
  end
61
62
  end
62
63
 
63
64
  nil
64
65
  end
65
-
66
- def add_id(path, parameters)
67
- parameters.each_pair do |key, value|
68
- next unless RSpec::OpenAPI::Extractors.number_or_nil(value)
69
-
70
- path = path.sub("/#{value}", "/:#{key}")
71
- end
72
-
73
- path
74
- end
75
66
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module OpenAPI
5
- VERSION = '0.18.1'
5
+ VERSION = '0.18.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-04-20 00:00:00.000000000 Z
12
+ date: 2024-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -109,7 +109,7 @@ licenses:
109
109
  metadata:
110
110
  homepage_uri: https://github.com/exoego/rspec-openapi
111
111
  source_code_uri: https://github.com/exoego/rspec-openapi
112
- changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.18.1
112
+ changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.18.2
113
113
  rubygems_mfa_required: 'true'
114
114
  post_install_message:
115
115
  rdoc_options: []