dox 2.1.0 → 2.3.0

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: 90c15cf757218b0357b046e8d4170b96ce3fb0072c59f68141653e04c0dd9a2e
4
- data.tar.gz: 47f6d55378aad845267e8d86ecb9a75f1625a0599ec35501bb0dd77f6006d97e
3
+ metadata.gz: 6a1fcae5e0c58ef6689eaede57da79f082f2207d6da123f5251d994deafbca75
4
+ data.tar.gz: 9a76f7f7e8be9312d3b3e509d1acec8d9fd39aa6e4004e3a1f9f2b2475005c61
5
5
  SHA512:
6
- metadata.gz: dd57224cb90c0803256d6427fbd520324d5eef21b2f66edcb0f4881fec48943e39eecb08eb42a39808c13fa1f121e8af3f69f8668c130616e96ea5ca67f0a396
7
- data.tar.gz: cd21d5496bfc0d28549be4546b0cf6f34bda12bcc05fc792dd2a0db7ac12a7a2199c18ddf20cef4c04d19b112dbb1b602f5dbe85843e6863f478737255bab89e
6
+ metadata.gz: 9713ae85d917e7fac673c5e3d78bf2ba3a9c04d943373b98c13c47b67dde4bf53fe5e1eec49117f919a22286120b9ffdcb47eed4bb749ff44661a039a326285d
7
+ data.tar.gz: 18c023ed7556dd63095d7473d858ea577a38e75a507830359a41ef4303ac29f0690e40a3f4aa1ab63dd3d5b5321adc58262b3ac67c1a70e16d20cf84c029fd6c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.5
1
+ 2.6.7
data/CHANGELOG.md ADDED
@@ -0,0 +1,156 @@
1
+ # Changelog
2
+
3
+ ## v2.3.0 (2024-02-20)
4
+
5
+ ### Enhancements
6
+
7
+ - Enable `#descriptions_location` config to be an array of pathname instances or fullpath strings, which will make dox search resource descriptions in more folders, not just one
8
+
9
+ ```bash
10
+ DEPRECATION WARNING: Rails 7.1 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead.
11
+ ```
12
+
13
+ ## v2.2.0 (2022-11-03)
14
+
15
+ ### Enhancements
16
+
17
+ - Prepare dox for Rails 7.1 - Start using `#media_type` on request and response objects (removes following deprecation message):
18
+
19
+ ```bash
20
+ DEPRECATION WARNING: Rails 7.1 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead.
21
+ ```
22
+
23
+ ## v2.1.0 (2021-03-26)
24
+
25
+ ### Enhancements
26
+
27
+ - Added 'activesupport' as a runtime dependency
28
+ - Dropped 'rails' as a runtime dependency
29
+
30
+
31
+ ## v2.0.0 (2020-08-08)
32
+
33
+ ### Enhancements
34
+
35
+ - Added `Dox.config.title`
36
+ - Added `Dox.config.header_description`
37
+ - Added `Dox.config.version`
38
+
39
+
40
+ ### Breaking changes / Deprecations
41
+
42
+ - [BREAKING] The API description format changed from API-blueprint to OpenAPI.
43
+ - [BREAKING] Base structure is now defined in .json format
44
+ - [BREAKING] Output is written to a .json file
45
+ - [BREAKING] Html is rendered with Redoc instead of Aglio
46
+ - [BREAKING] Renamed `Dox.config.desc_folder_path` -> `Dox.config.descriptions_location`
47
+ - [BREAKING] Removed `endpoint` method from document resource block
48
+ - [DEPRECATED] `Dox.config.header_file_path`
49
+
50
+
51
+ ## v1.3.0 (2021-03-26)
52
+
53
+ ### Enhancements
54
+
55
+ - Added 'activesupport' as a runtime dependency
56
+ - Dropped 'rails' as a runtime dependency
57
+
58
+
59
+ ## v1.2.0 (2019-11-27)
60
+
61
+ ### Enhancements
62
+
63
+ - Support Multipart payload with pretty formatting (based on `content-type` header)
64
+
65
+
66
+ ### Bugfixes
67
+
68
+ - Explicit passing of an empty hash for `params` in actions now works as expected
69
+
70
+
71
+ ## v1.1.0 (2018-02-19)
72
+
73
+ ### Enhancements
74
+
75
+ - Full RSpec failure dump to stderr if any test fails when running tests with Dox::Formatter
76
+ - Support any payload format with pretty formatting for JSON and XML (based on `content-type` header)
77
+
78
+
79
+ ### Bugfixes
80
+
81
+ - Ignore subdomain request header in headers output
82
+
83
+
84
+ ## v1.0.2 (2017-06-10)
85
+
86
+ ### Enhancements
87
+
88
+ - Set minimal Ruby version to 2.x
89
+
90
+
91
+ ### Bugfixes
92
+
93
+ - Fixed parsing blank request body string
94
+
95
+
96
+ ## v1.0.1 (2017-06-10)
97
+
98
+ ### Enhancements
99
+
100
+ - Add Rake tasks for generating documentation to Readme
101
+
102
+
103
+ ### Bugfixes
104
+
105
+ - Fix printing request body for test examples
106
+
107
+
108
+ ## v1.0.0 (2017-05-06)
109
+
110
+ ### Enhancements
111
+
112
+ - Guess path params for URI definition from example's request object
113
+ - Validate HTTP verbs specified in the descriptors' actions
114
+ - Document only examples whitelisted with `dox` tag
115
+ - Added option for whitelisting additional HTTP headers for examples
116
+ - Show request HTTP verb and fullpath for each action request
117
+ - Dox executable
118
+
119
+
120
+ ### Bugfixes
121
+
122
+ - Ignore body in query params (Rails 4 issue) for example request URL
123
+ - Pull request and response objects from example metadata
124
+
125
+
126
+ ## v1.0.0.alpha (2016-10-18)
127
+
128
+ ### Enhancements
129
+
130
+ - Updated the dependencies
131
+ - `extend Dox::DSL::Syntax` instead of `include Dox::DSL::Syntax` in descriptors
132
+
133
+
134
+ ### Breaking changes / Deprecations
135
+
136
+ - [BREAKING] Raise errors on missing required dox attributes in descriptors
137
+
138
+
139
+ ## v0.0.3 (2016-06-22)
140
+
141
+ ### Bugfixes
142
+
143
+ - Fixed example identifier for examples with query params
144
+
145
+
146
+ ## v0.0.2 (2016-06-14)
147
+
148
+ ### Enhancements
149
+
150
+ - Created core classes and a DSL for manipulating the examples in specs
151
+ - Added usage to readme
152
+
153
+
154
+ ## v0.0.1 (2016-06-06)
155
+
156
+ - First release of the dox gem where the initial gem skeleton has been created
data/README.md CHANGED
@@ -45,7 +45,7 @@ Set these optional options in the rails_helper:
45
45
 
46
46
  | Option | Value | Description |
47
47
  | -- | -- | -- |
48
- | descriptions_location | Pathname instance or fullpath string | Folder containing markdown descriptions of resources. |
48
+ | descriptions_location | Pathname instance or fullpath string (can be an array) | Folder containing markdown descriptions of resources. |
49
49
  | schema_request_folder_path | Pathname instance or fullpath string | Folder with request schemas of resources. |
50
50
  | schema_response_folder_path | Pathname instance or fullpath string | Folder with response schemas of resources. |
51
51
  | schema_response_fail_file_path | Pathname instance or fullpath string | Json file that contains the default schema of a failed response. |
data/lib/dox/config.rb CHANGED
@@ -12,9 +12,11 @@ module Dox
12
12
  attr_reader :descriptions_location
13
13
 
14
14
  def descriptions_location=(folder_path)
15
- raise(Errors::FolderNotFoundError, folder_path) unless Dir.exist?(folder_path)
15
+ Array(folder_path).each do |path|
16
+ raise(Errors::FolderNotFoundError, path) unless Dir.exist?(path)
17
+ end
16
18
 
17
- @descriptions_location = folder_path
19
+ @descriptions_location = Array(folder_path)
18
20
  end
19
21
 
20
22
  def schema_request_folder_path=(folder_path)
@@ -5,10 +5,8 @@ module Dox
5
5
 
6
6
  attr_reader :desc, :name, :request_schema, :response_schema_success, :response_schema_fail
7
7
 
8
- def_delegator :response, :status, :response_status
9
- def_delegator :response, :content_type, :response_content_type
10
- def_delegator :request, :content_type, :request_content_type
11
8
  def_delegator :request, :method, :request_method
9
+ def_delegator :response, :status, :response_status
12
10
 
13
11
  def initialize(details, request, response)
14
12
  @desc = details[:description]
@@ -53,6 +51,15 @@ module Dox
53
51
  end
54
52
  end
55
53
 
54
+ # Rails 7 changes content_type result
55
+ def request_content_type
56
+ request.respond_to?(:media_type) ? request.media_type : request.content_type
57
+ end
58
+
59
+ def response_content_type
60
+ response.respond_to?(:media_type) ? response.media_type : response.content_type
61
+ end
62
+
56
63
  private
57
64
 
58
65
  def format_content(http_env, content_type)
@@ -19,10 +19,15 @@ module Dox
19
19
  hash[key] = default
20
20
  end
21
21
 
22
- def read_file(path, root_path: Dox.config.descriptions_location)
23
- return '' unless root_path
22
+ def read_file(path, config_root_path: Dox.config.descriptions_location)
23
+ return '' unless config_root_path
24
24
 
25
- File.read(File.join(root_path, path))
25
+ config_root_path.each do |root_path|
26
+ file_path = File.join(root_path, path)
27
+ next unless File.exist?(file_path)
28
+
29
+ return File.read(file_path)
30
+ end
26
31
  end
27
32
 
28
33
  def formatted_body(body_str, content_type)
data/lib/dox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dox
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melita Kokot
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-03-26 00:00:00.000000000 Z
12
+ date: 2024-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -193,7 +193,7 @@ files:
193
193
  - ".rubocop.yml"
194
194
  - ".ruby-version"
195
195
  - ".travis.yml"
196
- - CHANGES.md
196
+ - CHANGELOG.md
197
197
  - CODE_OF_CONDUCT.md
198
198
  - Gemfile
199
199
  - LICENSE.txt
@@ -256,8 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubyforge_project:
260
- rubygems_version: 2.7.6.2
259
+ rubygems_version: 3.0.3.1
261
260
  signing_key:
262
261
  specification_version: 4
263
262
  summary: Generates API documentation for rspec in OpenAPI format.
data/CHANGES.md DELETED
@@ -1,113 +0,0 @@
1
- # Changelog
2
-
3
- ## Version 2.1.0
4
-
5
- Released on March 26, 2021
6
-
7
- Add:
8
- - 'activesupport' as a runtime dependency
9
-
10
- Drop:
11
- - 'rails' as a runtime dependency
12
-
13
- ## Version 2.0.0
14
-
15
- Released on August 8, 2020
16
-
17
- Change:
18
- - BREAKING CHANGE The API description format changed from API-blueprint to OpenAPI.
19
- - BREAKING CHANGE Base structure is now defined in .json format
20
- - BREAKING CHANGE Output is written to a .json file
21
- - BREAKING CHANGE Html is rendered with Redoc instead of Aglio
22
- - Renamed `Dox.config.desc_folder_path` -> `Dox.config.descriptions_location`
23
- - Depricated `Dox.config.header_file_path`
24
- - Removed `endpoint` method from document resource block
25
-
26
- New:
27
- - Added `Dox.config.title`
28
- - Added `Dox.config.header_description`
29
- - Added `Dox.config.version`
30
-
31
- ## Version 1.2.0
32
-
33
- Released on November 27, 2019
34
-
35
- New:
36
- - Support Multipart payload with pretty formatting (based on `content-type` header)
37
-
38
- Fix:
39
- - Explicit passing of an empty hash for `params` in actions now works as expected
40
-
41
-
42
- ## Version 1.1.0
43
-
44
- Released on February 19, 2018
45
-
46
- New:
47
- - Full RSpec failure dump to stderr if any test fails when running tests with Dox::Formatter
48
- - Support any payload format with pretty formatting for JSON and XML (based on `content-type` header)
49
-
50
- Fix:
51
- - Ignore subdomain request header in headers output
52
-
53
-
54
- ## Version 1.0.1
55
-
56
- Released on June 10, 2017
57
-
58
- New:
59
- - Add Rake tasks for generating documentation to Readme
60
-
61
- Fix:
62
- - Fix printing request body for test examples
63
-
64
-
65
- ## Version 1.0.0
66
-
67
- Released on May 6, 2017
68
-
69
- New:
70
- - Guess path params for URI definition from example's request object
71
- - Validate HTTP verbs specified in the descriptors' actions
72
- - Document only examples whitelisted with `dox` tag
73
- - Added option for whitelisting additional HTTP headers for examples
74
- - Show request HTTP verb and fullpath for each action request
75
- - Dox executable
76
-
77
- Fix:
78
- - Ignore body in query params (Rails 4 issue) for example request URL
79
- - Pull request and response objects from example metadata
80
-
81
- ## Version 1.0.0.alpha
82
-
83
- Released on October 18, 2016
84
-
85
- - Updated the dependencies
86
-
87
- New:
88
- - Raise errors on missing required dox attributes in descriptors
89
- - `extend Dox::DSL::Syntax` instead of `include Dox::DSL::Syntax` in descriptors
90
-
91
-
92
- ## Version 0.0.3
93
-
94
- Released on June 22, 2016
95
-
96
- Fix:
97
- - Fixed example identifier for examples with query params
98
-
99
-
100
- ## Version 0.0.2
101
-
102
-
103
- Released on June 14, 2016
104
-
105
- - Created core classes and a DSL for manipulating the examples in specs
106
- - Added usage to readme
107
-
108
-
109
- ## Version 0.0.1
110
-
111
- Released on June 06, 2016
112
-
113
- - First release of the dox gem where the initial gem skeleton has been created