rspec-openapi 0.2.0 → 0.2.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: a131e530d729238260cf30416962eccbcbde9e1dc93aa0dc14065fe245621671
4
- data.tar.gz: c94f05ec6f9ffe4b8f72e0bc6bf0f5cc1a7395977c6a2a671b361dcc1ba9f354
3
+ metadata.gz: cb2aae5a8366967c1ce6a904bb990372af7f5d3b09d4c81fad3866e590c168c3
4
+ data.tar.gz: 0665f9348a14cb0eb77c37368f69d3952d6eb71e919d8864931cdfbbbc3055dc
5
5
  SHA512:
6
- metadata.gz: acd6e8a4757c7610d5d92a5ee167995fe029f435b1c1bacf8f1b8eda8099b5fe3eef5e71eb4db26863e6fde7102abdcf7620896abec4da143ce2bd3d4ee3e9ef
7
- data.tar.gz: 66f7a5be114b32fcda8cd61236acda18e399ecb4a38daa30ee4b050d87f19aa604a3c84a6c82682dda5069a3affa3369d13521600b4f4e06210e3f6b49f96fb0
6
+ metadata.gz: 69ec6408d396d9e4c75bc4ba3ef1c71f82ea2a7bbd67def082262b275c20b9769db851fdb2c1bea971a4ede35c10b6f325fbc35a73be8591f12a986e94a01637
7
+ data.tar.gz: b71662890f9710012a329db3f380f831e10a8d37671fd9db2a9e3b84d237c699c0c40892020e4f20c781b36ab68563205208bc51607f73f5b2f002c80b5c48de
@@ -1,3 +1,10 @@
1
+ ## v0.2.1
2
+
3
+ * Generate `example` of request body and path / query params
4
+ [#4](https://github.com/k0kubun/rspec-openapi/issues/4)
5
+ * Remove a wrapper param created by Rails in request body
6
+ [#4](https://github.com/k0kubun/rspec-openapi/issues/4)
7
+
1
8
  ## v0.2.0
2
9
 
3
10
  * Generate `example` of response body [#3](https://github.com/k0kubun/rspec-openapi/issues/3)
@@ -15,7 +15,7 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
15
15
  path: route.path.spec.to_s.delete_suffix('(.:format)'),
16
16
  path_params: request.path_parameters,
17
17
  query_params: request.query_parameters,
18
- request_params: request.request_parameters,
18
+ request_params: raw_request_params(request),
19
19
  request_content_type: request.content_type,
20
20
  controller: route.requirements[:controller],
21
21
  action: route.requirements[:action],
@@ -35,4 +35,13 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
35
35
  end
36
36
  raise "No route matched for #{request.request_method} #{request.path_info}"
37
37
  end
38
+
39
+ # workaround to get real request parameters
40
+ # because ActionController::ParamsWrapper overwrites request_parameters
41
+ def raw_request_params(request)
42
+ original = request.delete_header('action_dispatch.request.request_parameters')
43
+ request.request_parameters
44
+ ensure
45
+ request.set_header('action_dispatch.request.request_parameters', original)
46
+ end
38
47
  end
@@ -38,6 +38,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
38
38
  in: 'path',
39
39
  required: true,
40
40
  schema: build_property(try_cast(value)),
41
+ example: try_cast(value),
41
42
  }
42
43
  end
43
44
 
@@ -46,6 +47,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
46
47
  name: key.to_s,
47
48
  in: 'query',
48
49
  schema: build_property(try_cast(value)),
50
+ example: try_cast(value),
49
51
  }
50
52
  end
51
53
 
@@ -61,6 +63,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
61
63
  content: {
62
64
  normalize_content_type(record.request_content_type) => {
63
65
  schema: build_property(record.request_params),
66
+ example: record.request_params,
64
67
  }
65
68
  }
66
69
  }
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-22 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.1.2
77
+ rubygems_version: 3.2.0.pre1
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Generate OpenAPI schema from RSpec request specs