rspec-openapi 0.18.1 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec/openapi/extractors/hanami.rb +4 -1
- data/lib/rspec/openapi/extractors/rails.rb +6 -15
- data/lib/rspec/openapi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d5e7e261220ae8c790eff0702c0d5e08dbf53667a410a1a540bdb4557d5f55
|
4
|
+
data.tar.gz: ffd9b3d5cab09166652fb03d1a22cf774170c6e80690ed4215e3483b951d8f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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,
|
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
|
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.
|
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-
|
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.
|
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: []
|