r2-oas 0.4.1 → 0.5.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 +4 -4
- data/CHANGELOG.md +11 -1
- data/README.ja.md +20 -7
- data/README.md +20 -7
- data/lib/r2-oas/configuration.rb +20 -30
- data/lib/r2-oas/configuration/paths_config.rb +6 -3
- data/lib/r2-oas/helpers/file_helper.rb +68 -0
- data/lib/r2-oas/plugin/hookable.rb +7 -2
- data/lib/r2-oas/public.rb +0 -2
- data/lib/r2-oas/schema/editor.rb +1 -1
- data/lib/r2-oas/schema/monitor.rb +1 -1
- data/lib/r2-oas/schema/ui.rb +1 -1
- data/lib/r2-oas/schema/v3/object/from_routes/{public.rb → all.rb} +0 -0
- data/lib/r2-oas/schema/v3/object/from_routes/base_object.rb +4 -38
- data/lib/r2-oas/schema/v3/object/from_routes/components/request_body_object.rb +6 -19
- data/lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb +4 -12
- data/lib/r2-oas/schema/v3/object/from_routes/components_object.rb +13 -7
- data/lib/r2-oas/schema/v3/object/from_routes/external_document_object.rb +2 -4
- data/lib/r2-oas/schema/v3/object/from_routes/info_object.rb +2 -4
- data/lib/r2-oas/schema/v3/object/from_routes/openapi_object.rb +9 -5
- data/lib/r2-oas/schema/v3/object/from_routes/path_item_object.rb +6 -6
- data/lib/r2-oas/schema/v3/object/from_routes/paths_object.rb +10 -30
- data/lib/r2-oas/tasks/main.rake +1 -2
- data/lib/r2-oas/version.rb +1 -1
- data/r2-oas.gemspec +1 -1
- metadata +10 -11
- data/lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb +0 -100
- data/lib/r2-oas/pluggable_configuration.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a8548f2c821fe7b76548b748dbe733ce0f11386d76ae046cc047b0fe0eb017b
|
4
|
+
data.tar.gz: ee6ebb9740a854142b929195a57206cf8cedfeb1f965e4217e048152effc03a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcdf6903f652e7109c137b05123d6d244aaec02e9bb2a1fd657bc710ae549c6d84bd887c281a2f881e070d757299f17334200273bb2b3f9e6b988d16578a246b
|
7
|
+
data.tar.gz: 129cfd622a8bd4c5b55bd5415cb24f24d0b918ea7cd9781aec7127b41640c3fe116b5f7e4dfe20add9ec68993d075471d172bd4919fda957893dc8b747c48ce2
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## v0.5.0
|
4
|
+
|
5
|
+
2020-01-29
|
6
|
+
|
7
|
+
- [`Breaking`] Remove `use_object_classes` option ([#171](https://github.com/yukihirop/r2-oas/pull/171))
|
8
|
+
- [`Feature`] Upgrade init command ([#176](https://github.com/yukihirop/r2-oas/pull/176))
|
9
|
+
- [`EOL`] EOL Ruby `2.3` and Support over Ruby `2.5.0` ([#170](https://github.com/yukihirop/r2-oas/pull/170))
|
10
|
+
|
11
|
+
Please see mileston [v0.5.0](https://github.com/yukihirop/r2-oas/milestone/5?closed=1)
|
2
12
|
|
3
13
|
## v0.4.1
|
4
14
|
|
data/README.ja.md
CHANGED
@@ -50,8 +50,17 @@ $ brew cask install chromedriver
|
|
50
50
|
gemをrequire後、以下のrakeタスクを実行するだけです。
|
51
51
|
|
52
52
|
```bash
|
53
|
-
bundle exec routes:oas:
|
54
|
-
|
53
|
+
$ bundle exec rake routes:oas:init
|
54
|
+
create oas_docs
|
55
|
+
create oas_docs/.paths
|
56
|
+
create oas_docs/plugins/helpers
|
57
|
+
create oas_docs/tasks/helpers
|
58
|
+
create oas_docs/plugins/.gitkeep
|
59
|
+
create oas_docs/plugins/helpers/.gitkeep
|
60
|
+
create oas_docs/tasks/.gitkeep
|
61
|
+
create oas_docs/tasks/helpers/.gitkeep
|
62
|
+
$ bundle exec rake routes:oas:docs
|
63
|
+
$ bundle exec rake routes:oas:editor
|
55
64
|
```
|
56
65
|
|
57
66
|
#### Generate docs
|
@@ -79,6 +88,14 @@ railsプロジェクトのルートディレクトリで以下のコマンドが
|
|
79
88
|
|
80
89
|
```bash
|
81
90
|
$ bundle exec rake routes:oas:init
|
91
|
+
create oas_docs
|
92
|
+
create oas_docs/.paths
|
93
|
+
create oas_docs/plugins/helpers
|
94
|
+
create oas_docs/tasks/helpers
|
95
|
+
create oas_docs/plugins/.gitkeep
|
96
|
+
create oas_docs/plugins/helpers/.gitkeep
|
97
|
+
create oas_docs/tasks/.gitkeep
|
98
|
+
create oas_docs/tasks/helpers/.gitkeep
|
82
99
|
```
|
83
100
|
|
84
101
|
### Generate
|
@@ -141,7 +158,7 @@ $ OAS_FILE="~/Desktop/swagger.yml" bundle exec rake routes:oas:analyze
|
|
141
158
|
|
142
159
|
## ❤️ Support Ruby Version
|
143
160
|
|
144
|
-
- Ruby (>= 2.
|
161
|
+
- Ruby (>= 2.5.0)
|
145
162
|
|
146
163
|
## ❤️ Support Rouging
|
147
164
|
|
@@ -185,8 +202,6 @@ OpenAPIの3.0.0をサポートしてます。
|
|
185
202
|
.
|
186
203
|
.
|
187
204
|
===== Bundle install for All Support Ruby Result =====
|
188
|
-
ruby-2.3.3: 0
|
189
|
-
ruby-2.4.2: 0
|
190
205
|
ruby-2.5.8: 0
|
191
206
|
ruby-2.6.6: 0
|
192
207
|
ruby-2.7.1: 0
|
@@ -214,8 +229,6 @@ ruby-2.7.1: 0
|
|
214
229
|
.
|
215
230
|
.
|
216
231
|
===== Rspec for All Support Ruby Result =====
|
217
|
-
ruby-2.3.3: 0
|
218
|
-
ruby-2.4.2: 0
|
219
232
|
ruby-2.5.8: 0
|
220
233
|
ruby-2.6.6: 0
|
221
234
|
ruby-2.7.1: 0
|
data/README.md
CHANGED
@@ -64,8 +64,17 @@ R2OAS.load_tasks
|
|
64
64
|
```
|
65
65
|
|
66
66
|
```bash
|
67
|
-
bundle exec routes:oas:
|
68
|
-
|
67
|
+
$ bundle exec rake routes:oas:init
|
68
|
+
create oas_docs
|
69
|
+
create oas_docs/.paths
|
70
|
+
create oas_docs/plugins/helpers
|
71
|
+
create oas_docs/tasks/helpers
|
72
|
+
create oas_docs/plugins/.gitkeep
|
73
|
+
create oas_docs/plugins/helpers/.gitkeep
|
74
|
+
create oas_docs/tasks/.gitkeep
|
75
|
+
create oas_docs/tasks/helpers/.gitkeep
|
76
|
+
$ bundle exec rake routes:oas:docs
|
77
|
+
$ bundle exec rake routes:oas:editor
|
69
78
|
```
|
70
79
|
|
71
80
|
#### Generate docs
|
@@ -90,6 +99,14 @@ Initialize r2-oas.
|
|
90
99
|
|
91
100
|
```bash
|
92
101
|
$ bundle exec rake routes:oas:init
|
102
|
+
create oas_docs
|
103
|
+
create oas_docs/.paths
|
104
|
+
create oas_docs/plugins/helpers
|
105
|
+
create oas_docs/tasks/helpers
|
106
|
+
create oas_docs/plugins/.gitkeep
|
107
|
+
create oas_docs/plugins/helpers/.gitkeep
|
108
|
+
create oas_docs/tasks/.gitkeep
|
109
|
+
create oas_docs/tasks/helpers/.gitkeep
|
93
110
|
```
|
94
111
|
|
95
112
|
### Generate
|
@@ -147,7 +164,7 @@ Full docs are available at https://yukihirop.github.io/r2-oas
|
|
147
164
|
|
148
165
|
## ❤️ Support Ruby Version
|
149
166
|
|
150
|
-
- Ruby (>= 2.
|
167
|
+
- Ruby (>= 2.5.0)
|
151
168
|
|
152
169
|
## ❤️ Support Rouging
|
153
170
|
|
@@ -189,8 +206,6 @@ Full docs are available at https://yukihirop.github.io/r2-oas/#/setting/configur
|
|
189
206
|
.
|
190
207
|
.
|
191
208
|
===== Bundle install for All Support Ruby Result =====
|
192
|
-
ruby-2.3.3: 0
|
193
|
-
ruby-2.4.2: 0
|
194
209
|
ruby-2.5.8: 0
|
195
210
|
ruby-2.6.6: 0
|
196
211
|
ruby-2.7.1: 0
|
@@ -218,8 +233,6 @@ ruby-2.7.1: 0
|
|
218
233
|
.
|
219
234
|
.
|
220
235
|
===== Rspec for All Support Ruby Result =====
|
221
|
-
ruby-2.3.3: 0
|
222
|
-
ruby-2.4.2: 0
|
223
236
|
ruby-2.5.8: 0
|
224
237
|
ruby-2.6.6: 0
|
225
238
|
ruby-2.7.1: 0
|
data/lib/r2-oas/configuration.rb
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
5
|
require_relative 'app_configuration'
|
6
|
-
require_relative 'pluggable_configuration'
|
7
6
|
require_relative 'configuration/paths_config'
|
8
7
|
require_relative 'logger/stdout_logger'
|
9
8
|
require_relative 'support/deprecation'
|
9
|
+
require_relative 'helpers/file_helper'
|
10
10
|
|
11
11
|
module R2OAS
|
12
12
|
module Configuration
|
13
13
|
extend AppConfiguration
|
14
|
-
|
14
|
+
include Helpers::FileHelper
|
15
15
|
|
16
|
-
PUBLIC_VALID_OPTIONS_KEYS = AppConfiguration::VALID_OPTIONS_KEYS
|
16
|
+
PUBLIC_VALID_OPTIONS_KEYS = AppConfiguration::VALID_OPTIONS_KEYS
|
17
17
|
|
18
18
|
UNPUBLIC_VALID_OPTIONS_KEYS = %i[
|
19
19
|
paths_config
|
@@ -24,18 +24,8 @@ module R2OAS
|
|
24
24
|
|
25
25
|
attr_accessor *PUBLIC_VALID_OPTIONS_KEYS
|
26
26
|
|
27
|
-
# MEMO: override because deprecated
|
28
|
-
def use_object_classes=(data)
|
29
|
-
::R2OAS::Deprecation.will_remove(<<-MSG.squish)
|
30
|
-
Using a R2OAS.use_object_classes= in configuration is deprecated and
|
31
|
-
will be removed in r2-oas (v0.4.2).
|
32
|
-
MSG
|
33
|
-
@use_object_classes = data
|
34
|
-
end
|
35
|
-
|
36
27
|
def self.extended(base)
|
37
28
|
base.send :set_default_for_configuration, base
|
38
|
-
base.send :set_default_for_pluggable, base
|
39
29
|
end
|
40
30
|
|
41
31
|
def configure
|
@@ -63,17 +53,14 @@ module R2OAS
|
|
63
53
|
end
|
64
54
|
end
|
65
55
|
|
66
|
-
def pluggable_configuration_options
|
67
|
-
PluggableConfiguration::VALID_OPTIONS_KEYS.inject({}) do |option, key|
|
68
|
-
option.merge!(key => send(key))
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
56
|
def load_tasks
|
73
57
|
load_local_tasks
|
74
58
|
end
|
75
59
|
|
76
60
|
def init
|
61
|
+
old_stdout = $stdout
|
62
|
+
$stdout = StringIO.new
|
63
|
+
|
77
64
|
plugins_path = File.expand_path("#{root_dir_path}/#{local_plugins_dir_name}")
|
78
65
|
plugins_helpers_path = "#{plugins_path}/helpers"
|
79
66
|
tasks_path = File.expand_path("#{root_dir_path}/#{local_tasks_dir_name}")
|
@@ -84,14 +71,21 @@ module R2OAS
|
|
84
71
|
gitkeep_tasks_path = "#{tasks_path}/.gitkeep"
|
85
72
|
gitkeep_tasks_helpers_path = "#{tasks_helpers_path}/.gitkeep"
|
86
73
|
|
87
|
-
|
88
|
-
|
74
|
+
paths_config.create_dot_paths(false)
|
75
|
+
mkdir_p_dir_or_skip(plugins_helpers_path)
|
76
|
+
mkdir_p_dir_or_skip(tasks_helpers_path)
|
77
|
+
write_file_or_skip(gitkeep_plugins_path, '')
|
78
|
+
write_file_or_skip(gitkeep_plugins_helpers_path, '')
|
79
|
+
write_file_or_skip(gitkeep_tasks_path, '')
|
80
|
+
write_file_or_skip(gitkeep_tasks_helpers_path, '')
|
81
|
+
|
82
|
+
if $stdout.string.present?
|
83
|
+
STDOUT.puts $stdout.string
|
84
|
+
else
|
85
|
+
STDOUT.puts "Already Initialized existing oas_docs in #{root_dir_path}"
|
86
|
+
end
|
89
87
|
|
90
|
-
|
91
|
-
File.write(gitkeep_plugins_helpers_path, '') unless FileTest.exists?(gitkeep_plugins_helpers_path)
|
92
|
-
File.write(gitkeep_tasks_path, '') unless FileTest.exists?(gitkeep_tasks_path)
|
93
|
-
File.write(gitkeep_tasks_helpers_path, '') unless FileTest.exists?(gitkeep_tasks_helpers_path)
|
94
|
-
paths_config.create_dot_paths
|
88
|
+
$stdout = old_stdout
|
95
89
|
end
|
96
90
|
|
97
91
|
def output_dir_path
|
@@ -117,9 +111,5 @@ module R2OAS
|
|
117
111
|
def set_default_for_configuration(target)
|
118
112
|
AppConfiguration.set_default(target)
|
119
113
|
end
|
120
|
-
|
121
|
-
def set_default_for_pluggable(target)
|
122
|
-
PluggableConfiguration.set_default(target)
|
123
|
-
end
|
124
114
|
end
|
125
115
|
end
|
@@ -1,10 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'r2-oas/schema/manager/file/path_item_file_manager'
|
4
|
+
require 'r2-oas/helpers/file_helper'
|
4
5
|
|
5
6
|
module R2OAS
|
6
7
|
module Configuration
|
7
8
|
class PathsConfig
|
9
|
+
include Helpers::FileHelper
|
10
|
+
|
8
11
|
def initialize(root_dir_path, schema_save_dir_name)
|
9
12
|
@root_dir_path = root_dir_path
|
10
13
|
@schema_save_dir_path = "#{root_dir_path}/#{schema_save_dir_name}"
|
@@ -25,11 +28,11 @@ module R2OAS
|
|
25
28
|
end.uniq.compact.reject(&:empty?)
|
26
29
|
end
|
27
30
|
|
28
|
-
def create_dot_paths
|
31
|
+
def create_dot_paths(silent = true)
|
29
32
|
abs_root_path = File.expand_path(@root_dir_path)
|
30
33
|
|
31
|
-
|
32
|
-
|
34
|
+
mkdir_p_dir_or_skip(abs_root_path, silent)
|
35
|
+
write_file_or_skip(abs_paths_path, '', silent)
|
33
36
|
end
|
34
37
|
|
35
38
|
def many_components_file_paths
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
# https :/ / keyesberry.hatenadiary.org / entry / 20101107 / p1
|
6
|
+
#
|
7
|
+
# Text attributes
|
8
|
+
# 0 All attributes off
|
9
|
+
# 1 Bold on
|
10
|
+
# 4 Underscore (on monochrome display adapter only)
|
11
|
+
# 5 Blink on
|
12
|
+
# 7 Reverse video on
|
13
|
+
# 8 Concealed on
|
14
|
+
|
15
|
+
# Foreground colors
|
16
|
+
# 30 Black
|
17
|
+
# 31 Red
|
18
|
+
# 32 Green
|
19
|
+
# 33 Yellow
|
20
|
+
# 34 Blue
|
21
|
+
# 35 Magenta
|
22
|
+
# 36 Cyan
|
23
|
+
# 37 White
|
24
|
+
|
25
|
+
# Background colors
|
26
|
+
# 40 Black
|
27
|
+
# 41 Red
|
28
|
+
# 42 Green
|
29
|
+
# 43 Yellow
|
30
|
+
# 44 Blue
|
31
|
+
# 45 Magenta
|
32
|
+
# 46 Cyan
|
33
|
+
# 47 White
|
34
|
+
module R2OAS
|
35
|
+
module Helpers
|
36
|
+
module FileHelper
|
37
|
+
def write_file_or_skip(file_path, data, silent = false)
|
38
|
+
unless FileTest.exists?(file_path)
|
39
|
+
File.write(file_path, data)
|
40
|
+
puts "#{space}#{bold('create')}\t#{relative(file_path)}" unless silent
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def mkdir_p_dir_or_skip(dir_path, silent = false)
|
45
|
+
unless FileTest.exists?(dir_path)
|
46
|
+
FileUtils.mkdir_p(dir_path)
|
47
|
+
puts "#{space}#{bold('create')}\t#{relative(dir_path)}" unless silent
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def relative(path)
|
54
|
+
current_dir_pathname = Pathname.new(Dir.pwd)
|
55
|
+
target_path = Pathname.new(path)
|
56
|
+
target_path.relative_path_from(current_dir_pathname)
|
57
|
+
end
|
58
|
+
|
59
|
+
def bold(str)
|
60
|
+
"\e[1m#{str}\e[0m"
|
61
|
+
end
|
62
|
+
|
63
|
+
def space
|
64
|
+
' '
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -5,6 +5,11 @@ require 'r2-oas/hooks/hook'
|
|
5
5
|
module R2OAS
|
6
6
|
module Plugin
|
7
7
|
module Hookable
|
8
|
+
def self.extended(base)
|
9
|
+
super
|
10
|
+
base.class_variable_set(:@@hook_klass, ::R2OAS::Hooks::Hook.register(:plugin, base))
|
11
|
+
end
|
12
|
+
|
8
13
|
def hooks_map
|
9
14
|
hook_klass.repository[:plugin]
|
10
15
|
end
|
@@ -14,11 +19,11 @@ module R2OAS
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def hook_klass=(klass)
|
17
|
-
|
22
|
+
class_variable_set(:@@hook_klass, klass)
|
18
23
|
end
|
19
24
|
|
20
25
|
def hook_klass
|
21
|
-
|
26
|
+
class_variable_get(:@@hook_klass)
|
22
27
|
end
|
23
28
|
|
24
29
|
def on(on, callback, once = false)
|
data/lib/r2-oas/public.rb
CHANGED
data/lib/r2-oas/schema/editor.rb
CHANGED
data/lib/r2-oas/schema/ui.rb
CHANGED
File without changes
|
@@ -16,40 +16,16 @@ module R2OAS
|
|
16
16
|
send("#{key}=", app_configuration_options[key])
|
17
17
|
end
|
18
18
|
|
19
|
-
PluggableConfiguration::VALID_OPTIONS_KEYS.each do |key|
|
20
|
-
instance_variable_set(:"@#{key}", pluggable_configuration_options[key])
|
21
|
-
end
|
22
|
-
|
23
19
|
@opts = opts
|
24
20
|
@plugin_executor = ::R2OAS::Plugin::Executor.new(@plugins, opts)
|
25
21
|
end
|
26
22
|
|
27
|
-
def
|
28
|
-
@
|
29
|
-
end
|
30
|
-
|
31
|
-
def paths_object_class
|
32
|
-
@use_object_classes[:paths_object]
|
33
|
-
end
|
34
|
-
|
35
|
-
def path_item_object_class
|
36
|
-
@use_object_classes[:path_item_object]
|
37
|
-
end
|
38
|
-
|
39
|
-
def external_document_object_class
|
40
|
-
@use_object_classes[:external_document_object]
|
41
|
-
end
|
42
|
-
|
43
|
-
def components_object_class
|
44
|
-
@use_object_classes[:components_object]
|
23
|
+
def doc
|
24
|
+
@doc ||= {}
|
45
25
|
end
|
46
26
|
|
47
|
-
def
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def components_request_body_object_class
|
52
|
-
@use_object_classes[:components_request_body_object]
|
27
|
+
def to_doc
|
28
|
+
raise 'Implement Inherit Class'
|
53
29
|
end
|
54
30
|
|
55
31
|
private
|
@@ -58,17 +34,7 @@ module R2OAS
|
|
58
34
|
R2OAS.app_configuration_options
|
59
35
|
end
|
60
36
|
|
61
|
-
def pluggable_configuration_options
|
62
|
-
R2OAS.pluggable_configuration_options
|
63
|
-
end
|
64
|
-
|
65
|
-
# Can not define attr_accessor for PluggableConfiguration::VALID_OPTIONS_KEYS.
|
66
|
-
# Because, PuggableConfiguration module is not loaded when this class is loaded.
|
67
37
|
attr_accessor *AppConfiguration::VALID_OPTIONS_KEYS
|
68
|
-
|
69
|
-
def to_doc
|
70
|
-
raise 'Implement Inherit Class'
|
71
|
-
end
|
72
38
|
end
|
73
39
|
end
|
74
40
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'r2-oas/
|
3
|
+
require 'r2-oas/schema/v3/object/from_routes/base_object'
|
4
4
|
require 'r2-oas/schema/v3/manager/file/components_file_manager'
|
5
|
+
require_relative 'schema_object'
|
5
6
|
|
6
7
|
module R2OAS
|
7
8
|
module Schema
|
8
9
|
module V3
|
9
10
|
module Components
|
10
|
-
class RequestBodyObject < R2OAS::
|
11
|
+
class RequestBodyObject < R2OAS::Schema::V3::BaseObject
|
11
12
|
def initialize(route_data, path, opts = {})
|
12
13
|
super(opts)
|
13
14
|
@path_comp = Routing::PathComponent.new(path)
|
@@ -23,10 +24,9 @@ module R2OAS
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def to_doc
|
26
|
-
execute_before_create(@schema_name)
|
27
27
|
create_doc do
|
28
28
|
child_file_manager = ComponentsFileManager.new("#/components/schemas/#{_components_schema_name}", :ref)
|
29
|
-
schema_object =
|
29
|
+
schema_object = Components::SchemaObject.new(@route_data, @path, @opts)
|
30
30
|
|
31
31
|
unless child_file_manager.skip_save?
|
32
32
|
result = {
|
@@ -45,22 +45,9 @@ module R2OAS
|
|
45
45
|
)
|
46
46
|
end
|
47
47
|
end
|
48
|
-
execute_after_create(@schema_name)
|
49
48
|
doc
|
50
49
|
end
|
51
50
|
|
52
|
-
# MEMO:
|
53
|
-
# please override in inherited class.
|
54
|
-
def components_schema_name(_doc, _path_component, _tag_name, _verb, schema_name)
|
55
|
-
schema_name
|
56
|
-
end
|
57
|
-
|
58
|
-
# MEMO:
|
59
|
-
# please override in inherited class.
|
60
|
-
def components_request_body_name(_doc, _path_component, _tag_name, _verb, schema_name)
|
61
|
-
schema_name
|
62
|
-
end
|
63
|
-
|
64
51
|
def generate?
|
65
52
|
file_manager = ComponentsFileManager.new("#/components/schemas/#{_components_schema_name}", :ref)
|
66
53
|
(@verb.in? http_methods_when_generate_request_body) && !file_manager.skip_save?
|
@@ -83,11 +70,11 @@ module R2OAS
|
|
83
70
|
end
|
84
71
|
|
85
72
|
def _components_schema_name
|
86
|
-
|
73
|
+
@schema_name
|
87
74
|
end
|
88
75
|
|
89
76
|
def _components_request_body_name
|
90
|
-
|
77
|
+
@schema_name
|
91
78
|
end
|
92
79
|
end
|
93
80
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'r2-oas/
|
3
|
+
require 'r2-oas/schema/v3/object/from_routes/base_object'
|
4
4
|
|
5
5
|
module R2OAS
|
6
6
|
module Schema
|
7
7
|
module V3
|
8
8
|
module Components
|
9
|
-
class SchemaObject < R2OAS::
|
9
|
+
class SchemaObject < R2OAS::Schema::V3::BaseObject
|
10
10
|
def initialize(route_data, path, opts = {})
|
11
11
|
super(opts)
|
12
12
|
@path_comp = Routing::PathComponent.new(path)
|
@@ -22,18 +22,10 @@ module R2OAS
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def to_doc
|
25
|
-
execute_before_create(@schema_name)
|
26
25
|
create_doc
|
27
|
-
execute_after_create(@schema_name)
|
28
26
|
doc
|
29
27
|
end
|
30
28
|
|
31
|
-
# MEMO:
|
32
|
-
# please override in inherited class.
|
33
|
-
def components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name)
|
34
|
-
schema_name
|
35
|
-
end
|
36
|
-
|
37
29
|
private
|
38
30
|
|
39
31
|
def create_doc
|
@@ -49,8 +41,8 @@ module R2OAS
|
|
49
41
|
doc.merge!(result)
|
50
42
|
end
|
51
43
|
|
52
|
-
def _components_schema_name(
|
53
|
-
|
44
|
+
def _components_schema_name(_http_status)
|
45
|
+
@schema_name
|
54
46
|
end
|
55
47
|
end
|
56
48
|
end
|
@@ -1,18 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'base_object'
|
4
4
|
require_relative 'components/schema_object'
|
5
5
|
require_relative 'components/request_body_object'
|
6
|
+
require_relative 'path_item_object'
|
6
7
|
|
7
8
|
module R2OAS
|
8
9
|
module Schema
|
9
10
|
module V3
|
10
|
-
class ComponentsObject <
|
11
|
+
class ComponentsObject < BaseObject
|
11
12
|
def initialize(routes_data, opts = {})
|
12
13
|
super(opts)
|
13
14
|
@routes_data = routes_data
|
14
15
|
end
|
15
16
|
|
17
|
+
def to_doc
|
18
|
+
create_doc
|
19
|
+
doc
|
20
|
+
end
|
21
|
+
|
16
22
|
def create_doc
|
17
23
|
create_doc_for_components_schemas!
|
18
24
|
create_doc_for_components_request_bodies!
|
@@ -24,14 +30,14 @@ module R2OAS
|
|
24
30
|
result = components_schema_docs.each_with_object({}) do |(schema_name, components_schema_doc), docs|
|
25
31
|
docs[schema_name] = components_schema_doc
|
26
32
|
end
|
27
|
-
doc.merge!('schemas' => result)
|
33
|
+
doc.merge!({ 'schemas' => result })
|
28
34
|
end
|
29
35
|
|
30
36
|
def create_doc_for_components_request_bodies!
|
31
37
|
result = components_request_body_docs.each_with_object({}) do |(schema_name, components_request_body_doc), docs|
|
32
38
|
docs[schema_name] = components_request_body_doc
|
33
39
|
end
|
34
|
-
doc.merge!('requestBodies' => result)
|
40
|
+
doc.merge!({ 'requestBodies' => result })
|
35
41
|
end
|
36
42
|
|
37
43
|
# e.x.)
|
@@ -43,9 +49,9 @@ module R2OAS
|
|
43
49
|
path = route_el[:path]
|
44
50
|
route_data = route_el[:data]
|
45
51
|
|
46
|
-
path_item_object =
|
52
|
+
path_item_object = PathItemObject.new(route_data, path, @opts)
|
47
53
|
path_item_object.http_statuses.each do |http_status|
|
48
|
-
components_schema_object =
|
54
|
+
components_schema_object = Components::SchemaObject.new(route_data, path, @opts)
|
49
55
|
components_schema_doc = components_schema_object.to_doc
|
50
56
|
schema_name = components_schema_object.send(:_components_schema_name, http_status)
|
51
57
|
|
@@ -63,7 +69,7 @@ module R2OAS
|
|
63
69
|
path = route_el[:path]
|
64
70
|
route_data = route_el[:data]
|
65
71
|
|
66
|
-
components_request_body_object =
|
72
|
+
components_request_body_object = Components::RequestBodyObject.new(route_data, path, @opts)
|
67
73
|
next unless components_request_body_object.generate?
|
68
74
|
|
69
75
|
components_request_body_doc = components_request_body_object.to_doc
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'base_object'
|
4
4
|
|
5
5
|
module R2OAS
|
6
6
|
module Schema
|
7
7
|
module V3
|
8
|
-
class ExternalDocumentObject <
|
8
|
+
class ExternalDocumentObject < BaseObject
|
9
9
|
def to_doc
|
10
|
-
execute_before_create
|
11
10
|
create_doc
|
12
|
-
execute_after_create
|
13
11
|
doc
|
14
12
|
end
|
15
13
|
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'base_object'
|
4
4
|
|
5
5
|
module R2OAS
|
6
6
|
module Schema
|
7
7
|
module V3
|
8
|
-
class InfoObject <
|
8
|
+
class InfoObject < BaseObject
|
9
9
|
def to_doc
|
10
|
-
execute_before_create
|
11
10
|
create_doc
|
12
|
-
execute_after_create
|
13
11
|
doc
|
14
12
|
end
|
15
13
|
|
@@ -3,6 +3,10 @@
|
|
3
3
|
require_relative 'base_object'
|
4
4
|
require_relative 'tag_object'
|
5
5
|
require_relative 'server_object'
|
6
|
+
require_relative 'info_object'
|
7
|
+
require_relative 'external_document_object'
|
8
|
+
require_relative 'components_object'
|
9
|
+
require_relative 'paths_object'
|
6
10
|
|
7
11
|
module R2OAS
|
8
12
|
module Schema
|
@@ -25,13 +29,13 @@ module R2OAS
|
|
25
29
|
'servers' => servers_doc,
|
26
30
|
'components' => components_doc
|
27
31
|
}
|
28
|
-
result
|
32
|
+
doc.merge!(result)
|
29
33
|
end
|
30
34
|
|
31
35
|
private
|
32
36
|
|
33
37
|
def info_doc
|
34
|
-
|
38
|
+
InfoObject.new(@opts).to_doc
|
35
39
|
end
|
36
40
|
|
37
41
|
def tags_doc
|
@@ -39,11 +43,11 @@ module R2OAS
|
|
39
43
|
end
|
40
44
|
|
41
45
|
def paths_doc
|
42
|
-
|
46
|
+
PathsObject.new(@routes_data, @opts).to_doc
|
43
47
|
end
|
44
48
|
|
45
49
|
def external_docs_doc
|
46
|
-
|
50
|
+
ExternalDocumentObject.new(@opts).to_doc
|
47
51
|
end
|
48
52
|
|
49
53
|
def servers_doc
|
@@ -51,7 +55,7 @@ module R2OAS
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def components_doc
|
54
|
-
|
58
|
+
ComponentsObject.new(@routes_data, @opts).to_doc
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'forwardable'
|
4
|
-
require 'r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object'
|
5
4
|
require 'r2-oas/routing/components/path_component'
|
5
|
+
require_relative 'base_object'
|
6
|
+
require_relative 'components/schema_object'
|
7
|
+
require_relative 'components/request_body_object'
|
6
8
|
|
7
9
|
module R2OAS
|
8
10
|
module Schema
|
9
11
|
module V3
|
10
|
-
class PathItemObject <
|
12
|
+
class PathItemObject < BaseObject
|
11
13
|
extend Forwardable
|
12
14
|
# reference
|
13
15
|
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#path-item-object
|
@@ -27,15 +29,13 @@ module R2OAS
|
|
27
29
|
@required_parameters = route_data[:required_parameters]
|
28
30
|
@format_name = create_format_name
|
29
31
|
@http_status_manager = HttpStatusManager.new(@path, @verb, http_statuses_when_http_method)
|
30
|
-
@components_schema_object =
|
31
|
-
@components_request_body_object =
|
32
|
+
@components_schema_object = Components::SchemaObject.new(route_data, path, opts)
|
33
|
+
@components_request_body_object = Components::RequestBodyObject.new(route_data, path, opts)
|
32
34
|
support_field_name? if route_data.key?(:verb)
|
33
35
|
end
|
34
36
|
|
35
37
|
def to_doc
|
36
|
-
execute_before_create(@path)
|
37
38
|
create_doc
|
38
|
-
execute_after_create(@path)
|
39
39
|
doc
|
40
40
|
end
|
41
41
|
|
@@ -1,23 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object'
|
4
3
|
require 'r2-oas/routing/components/path_component'
|
4
|
+
require_relative 'base_object'
|
5
|
+
require_relative 'path_item_object'
|
5
6
|
|
6
7
|
module R2OAS
|
7
8
|
module Schema
|
8
9
|
module V3
|
9
|
-
class PathsObject <
|
10
|
+
class PathsObject < BaseObject
|
10
11
|
def initialize(routes_data, opts = {})
|
11
12
|
super(opts)
|
12
13
|
@routes_data = routes_data
|
13
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_doc
|
17
|
+
create_doc
|
18
|
+
doc
|
14
19
|
end
|
15
20
|
|
16
21
|
def create_doc
|
17
22
|
if unit_paths_file_path.present?
|
18
23
|
unit_paths_data = YAML.load_file(unit_paths_file_path)['paths']
|
19
24
|
result = unit_paths_data.each_with_object({}) do |(path, path_item_doc), docs|
|
20
|
-
docs[path] =
|
25
|
+
docs[path] = PathItemObject.new(path_item_doc, path, @opts).to_doc
|
21
26
|
end
|
22
27
|
else
|
23
28
|
result = path_item_docs.each_with_object({}) do |(path, path_item_doc), docs|
|
@@ -29,31 +34,6 @@ module R2OAS
|
|
29
34
|
|
30
35
|
private
|
31
36
|
|
32
|
-
def define_hookable_tmp_object_class
|
33
|
-
klass = Class.new(path_item_object_class) do |_c|
|
34
|
-
def initialize(data, path, opts = {})
|
35
|
-
super(opts)
|
36
|
-
@data = data
|
37
|
-
@path = path
|
38
|
-
@path_comp = Routing::PathComponent.new(path)
|
39
|
-
use_superclass_hook
|
40
|
-
end
|
41
|
-
|
42
|
-
def create_doc
|
43
|
-
doc.merge!(@data)
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_doc
|
47
|
-
execute_before_create(@path)
|
48
|
-
create_doc
|
49
|
-
execute_after_create(@path)
|
50
|
-
execute_transform_plugins(:path_item, doc, @path_comp)
|
51
|
-
doc
|
52
|
-
end
|
53
|
-
end
|
54
|
-
Object.const_set(:HookableTmpObjectClass, klass) unless defined?(HookableTmpObjectClass)
|
55
|
-
end
|
56
|
-
|
57
37
|
def path_item_docs
|
58
38
|
# e.x.)
|
59
39
|
# [
|
@@ -63,7 +43,7 @@ module R2OAS
|
|
63
43
|
path = route_el[:path]
|
64
44
|
route_data = route_el[:data]
|
65
45
|
|
66
|
-
path_item_doc =
|
46
|
+
path_item_doc = PathItemObject.new(route_data, path, @opts).to_doc
|
67
47
|
if data[path].present?
|
68
48
|
data[path].merge!(path_item_doc)
|
69
49
|
else
|
data/lib/r2-oas/tasks/main.rake
CHANGED
@@ -10,9 +10,8 @@ load File.expand_path('common.rake', __dir__)
|
|
10
10
|
namespace :routes do
|
11
11
|
namespace :oas do
|
12
12
|
desc '[R2-OAS] Initialize'
|
13
|
-
task init
|
13
|
+
task :init do
|
14
14
|
R2OAS.init
|
15
|
-
puts '[R2-OAS] Initialized!'
|
16
15
|
end
|
17
16
|
|
18
17
|
desc '[R2-OAS] Generate OAS documentation files'
|
data/lib/r2-oas/version.rb
CHANGED
data/r2-oas.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.bindir = 'exe'
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
30
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
31
31
|
|
32
32
|
spec.add_runtime_dependency 'docker-api', '>= 1.34.2'
|
33
33
|
spec.add_runtime_dependency 'easy_diff', '>= 1.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r2-oas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yukihirop
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -240,8 +240,8 @@ files:
|
|
240
240
|
- lib/r2-oas/configuration/paths_config.rb
|
241
241
|
- lib/r2-oas/deploy/client.rb
|
242
242
|
- lib/r2-oas/deploy/swagger-ui/index.html.erb
|
243
|
-
- lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb
|
244
243
|
- lib/r2-oas/errors.rb
|
244
|
+
- lib/r2-oas/helpers/file_helper.rb
|
245
245
|
- lib/r2-oas/hooks/global_hook.rb
|
246
246
|
- lib/r2-oas/hooks/hook.rb
|
247
247
|
- lib/r2-oas/hooks/repository.rb
|
@@ -251,7 +251,6 @@ files:
|
|
251
251
|
- lib/r2-oas/lib/core_ext/string/filters.rb
|
252
252
|
- lib/r2-oas/lib/three-way-merge/twm.rb
|
253
253
|
- lib/r2-oas/logger/stdout_logger.rb
|
254
|
-
- lib/r2-oas/pluggable_configuration.rb
|
255
254
|
- lib/r2-oas/plugin/base.rb
|
256
255
|
- lib/r2-oas/plugin/executor.rb
|
257
256
|
- lib/r2-oas/plugin/hookable.rb
|
@@ -323,6 +322,7 @@ files:
|
|
323
322
|
- lib/r2-oas/schema/v3/object/from_files/utils/all.rb
|
324
323
|
- lib/r2-oas/schema/v3/object/from_files/utils/deep_methods.rb
|
325
324
|
- lib/r2-oas/schema/v3/object/from_files/utils/refs.rb
|
325
|
+
- lib/r2-oas/schema/v3/object/from_routes/all.rb
|
326
326
|
- lib/r2-oas/schema/v3/object/from_routes/base_object.rb
|
327
327
|
- lib/r2-oas/schema/v3/object/from_routes/components/request_body_object.rb
|
328
328
|
- lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb
|
@@ -332,7 +332,6 @@ files:
|
|
332
332
|
- lib/r2-oas/schema/v3/object/from_routes/openapi_object.rb
|
333
333
|
- lib/r2-oas/schema/v3/object/from_routes/path_item_object.rb
|
334
334
|
- lib/r2-oas/schema/v3/object/from_routes/paths_object.rb
|
335
|
-
- lib/r2-oas/schema/v3/object/from_routes/public.rb
|
336
335
|
- lib/r2-oas/schema/v3/object/from_routes/server_object.rb
|
337
336
|
- lib/r2-oas/schema/v3/object/from_routes/tag_object.rb
|
338
337
|
- lib/r2-oas/schema/v3/object/store.rb
|
@@ -359,10 +358,10 @@ licenses:
|
|
359
358
|
- MIT
|
360
359
|
metadata:
|
361
360
|
bug_tracker_uri: https://github.com/yukihirop/r2-oas/issues
|
362
|
-
changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.
|
361
|
+
changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.5.0/CHANGELOG.md
|
363
362
|
documentation_uri: https://yukihirop.github.io/r2-oas
|
364
|
-
source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.
|
365
|
-
post_install_message:
|
363
|
+
source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.5.0
|
364
|
+
post_install_message:
|
366
365
|
rdoc_options: []
|
367
366
|
require_paths:
|
368
367
|
- lib
|
@@ -370,7 +369,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
370
369
|
requirements:
|
371
370
|
- - ">="
|
372
371
|
- !ruby/object:Gem::Version
|
373
|
-
version: 2.
|
372
|
+
version: 2.5.0
|
374
373
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
375
374
|
requirements:
|
376
375
|
- - ">="
|
@@ -378,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
378
377
|
version: '0'
|
379
378
|
requirements: []
|
380
379
|
rubygems_version: 3.1.2
|
381
|
-
signing_key:
|
380
|
+
signing_key:
|
382
381
|
specification_version: 4
|
383
382
|
summary: Provide rake tasks to management API Docment (OpenAPI)
|
384
383
|
test_files: []
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'r2-oas/schema/v3/object/from_routes/base_object'
|
4
|
-
require 'r2-oas/hooks/hook'
|
5
|
-
|
6
|
-
module R2OAS
|
7
|
-
module Dynamic
|
8
|
-
module Schema
|
9
|
-
module V3
|
10
|
-
class HookableBaseObject < R2OAS::Schema::V3::BaseObject
|
11
|
-
module ClassMethods
|
12
|
-
def before_create(&block)
|
13
|
-
proc = (block_given? ? block : proc {})
|
14
|
-
on(:before_create, proc)
|
15
|
-
end
|
16
|
-
|
17
|
-
def after_create(&block)
|
18
|
-
proc = (block_given? ? block : proc {})
|
19
|
-
on(:after_create, proc)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.inherited(base)
|
24
|
-
base.extend ClassMethods
|
25
|
-
self.hook = Hooks::Hook.register(:dynamic, base)
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.hooks
|
29
|
-
superclass.hook.repository[:dynamic][self].global_hooks_data
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.hook=(value)
|
33
|
-
@@hook = value
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.hook
|
37
|
-
@@hook
|
38
|
-
end
|
39
|
-
|
40
|
-
class << self
|
41
|
-
def on(on, callback, once = false)
|
42
|
-
hook.on(on, callback, self, once)
|
43
|
-
end
|
44
|
-
|
45
|
-
# MEMO: Do not Use
|
46
|
-
def off(on, callback, once = false)
|
47
|
-
hook.off(on, callback, self, once)
|
48
|
-
end
|
49
|
-
|
50
|
-
def execute_hook(on, *data)
|
51
|
-
hook.execute_hook(on, *data, self)
|
52
|
-
end
|
53
|
-
|
54
|
-
def has_hook?(name)
|
55
|
-
hook.has_hook?(name, self)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
attr_accessor :doc
|
60
|
-
|
61
|
-
def initialize(opts = {})
|
62
|
-
super(opts)
|
63
|
-
self.doc = {}
|
64
|
-
end
|
65
|
-
|
66
|
-
# MEMO: Please overwrite when passing arguments other than `doc`
|
67
|
-
def to_doc
|
68
|
-
execute_before_create
|
69
|
-
create_doc
|
70
|
-
execute_after_create
|
71
|
-
doc
|
72
|
-
end
|
73
|
-
|
74
|
-
def use_superclass_hook
|
75
|
-
self.class.hook.repository[:dynamic][self.class] = self.class.hook.repository[:dynamic][self.class.superclass]
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def create_doc
|
81
|
-
raise NoImplementError
|
82
|
-
end
|
83
|
-
|
84
|
-
def execute_before_create(*data)
|
85
|
-
execute_hook_method(:before_create, *data)
|
86
|
-
end
|
87
|
-
|
88
|
-
def execute_after_create(*data)
|
89
|
-
execute_hook_method(:after_create, *data)
|
90
|
-
end
|
91
|
-
|
92
|
-
def execute_hook_method(method_name, *data)
|
93
|
-
args = [doc].push(*data)
|
94
|
-
self.class.execute_hook(method_name.to_sym, *args) if self.class.has_hook?(method_name.to_sym)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'r2-oas/schema/v3/object/from_routes/public'
|
4
|
-
require_relative 'support/deprecation'
|
5
|
-
|
6
|
-
module R2OAS
|
7
|
-
module PluggableConfiguration
|
8
|
-
# rubocop:disable Style/MutableConstant
|
9
|
-
DEFAULT_USE_OBJECT_CLASSES = {
|
10
|
-
info_object: R2OAS::Schema::V3::InfoObject,
|
11
|
-
paths_object: R2OAS::Schema::V3::PathsObject,
|
12
|
-
path_item_object: R2OAS::Schema::V3::PathItemObject,
|
13
|
-
external_document_object: R2OAS::Schema::V3::ExternalDocumentObject,
|
14
|
-
components_object: R2OAS::Schema::V3::ComponentsObject,
|
15
|
-
components_schema_object: R2OAS::Schema::V3::Components::SchemaObject,
|
16
|
-
components_request_body_object: R2OAS::Schema::V3::Components::RequestBodyObject
|
17
|
-
}
|
18
|
-
# rubocop:enable Style/MutableConstant
|
19
|
-
|
20
|
-
VALID_OPTIONS_KEYS = %i[
|
21
|
-
use_object_classes
|
22
|
-
].freeze
|
23
|
-
|
24
|
-
attr_reader *VALID_OPTIONS_KEYS
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
module_function
|
29
|
-
|
30
|
-
def set_default(target)
|
31
|
-
Deprecation.silence do
|
32
|
-
target.use_object_classes = DEFAULT_USE_OBJECT_CLASSES
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|