oas_rails 0.11.0 → 0.12.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/README.md +1 -1
- data/app/views/oas_rails/oas_rails/index.html.erb +1 -0
- data/lib/oas_rails/configuration.rb +10 -1
- data/lib/oas_rails/extractors/route_extractor.rb +5 -32
- data/lib/oas_rails/version.rb +1 -1
- data/lib/oas_rails.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b929476e50a9620b4239738c1753cada50eaa6198ec363afe75dc2690f202504
|
4
|
+
data.tar.gz: df7125a57463f2782254b316cd235a6b11e075e5010bc07d61e6aca8e555cd47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95119f77419a24df6f3d22ef941e2dae351ad965ff2e8b84a7285a73932ab5e617d60c6c4ccfb08dfd44f555c58691ad1053b9983699d3f18b9f3c5a8a626693
|
7
|
+
data.tar.gz: b4cce805735d6c2f0ba7f653bf778f59d7dd4c92be23128cac8bfd2ac0c185ccfd3b79e1f149cb1c17a0d083e8d7e83777b89f2bb96462c1acd2cfefdd6d25b9
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ The goal is to minimize the effort required to create comprehensive documentatio
|
|
39
39
|
|
40
40
|
## Documentation
|
41
41
|
|
42
|
-
For see how to install, configure and use OasRails please refere to the [OasRailsBook](http://a-chacon.com/oas_rails
|
42
|
+
For see how to install, configure and use OasRails please refere to the [OasRailsBook](http://a-chacon.com/oas_rails)
|
43
43
|
|
44
44
|
## Contributing
|
45
45
|
|
@@ -15,7 +15,8 @@ module OasRails
|
|
15
15
|
:http_verbs,
|
16
16
|
:use_model_names,
|
17
17
|
:rapidoc_theme
|
18
|
-
|
18
|
+
|
19
|
+
attr_reader :servers, :tags, :security_schema, :include_mode
|
19
20
|
|
20
21
|
def initialize
|
21
22
|
@info = Spec::Info.new
|
@@ -37,6 +38,7 @@ module OasRails
|
|
37
38
|
@response_body_of_default = "Hash{ success: !Boolean, message: String }"
|
38
39
|
@use_model_names = false
|
39
40
|
@rapidoc_theme = :rails
|
41
|
+
@include_mode = :all
|
40
42
|
end
|
41
43
|
|
42
44
|
def security_schema=(value)
|
@@ -64,6 +66,13 @@ module OasRails
|
|
64
66
|
def excluded_columns_outgoing
|
65
67
|
[]
|
66
68
|
end
|
69
|
+
|
70
|
+
def include_mode=(value)
|
71
|
+
valid_modes = [:all, :with_tags, :explicit]
|
72
|
+
raise ArgumentError, "include_mode must be one of #{valid_modes}" unless valid_modes.include?(value)
|
73
|
+
|
74
|
+
@include_mode = value
|
75
|
+
end
|
67
76
|
end
|
68
77
|
|
69
78
|
DEFAULT_SECURITY_SCHEMES = {
|
@@ -45,41 +45,14 @@ module OasRails
|
|
45
45
|
route.gsub('(.:format)', '').gsub(/:\w+/) { |match| "{#{match[1..]}}" }
|
46
46
|
end
|
47
47
|
|
48
|
-
# THIS CODE IS NOT IN USE BUT CAN BE USEFULL WITH GLOBAL TAGS OR AUTH TAGS
|
49
|
-
# def get_controller_comments(controller_path)
|
50
|
-
# YARD.parse_string(File.read(controller_path))
|
51
|
-
# controller_class = YARD::Registry.all(:class).first
|
52
|
-
# if controller_class
|
53
|
-
# class_comment = controller_class.docstring.all
|
54
|
-
# method_comments = controller_class.meths.map do |method|
|
55
|
-
# {
|
56
|
-
# name: method.name,
|
57
|
-
# comment: method.docstring.all
|
58
|
-
# }
|
59
|
-
# end
|
60
|
-
# YARD::Registry.clear
|
61
|
-
# {
|
62
|
-
# class_comment: class_comment,
|
63
|
-
# method_comments: method_comments
|
64
|
-
# }
|
65
|
-
# else
|
66
|
-
# YARD::Registry.clear
|
67
|
-
# nil
|
68
|
-
# end
|
69
|
-
# rescue StandardError
|
70
|
-
# nil
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# def get_controller_comment(controller_path)
|
74
|
-
# get_controller_comments(controller_path)&.dig(:class_comment) || ''
|
75
|
-
# rescue StandardError
|
76
|
-
# ''
|
77
|
-
# end
|
78
|
-
|
79
48
|
private
|
80
49
|
|
81
50
|
def extract_host_routes
|
82
|
-
valid_routes.map { |r| OasRoute.new_from_rails_route(rails_route: r) }
|
51
|
+
routes = valid_routes.map { |r| OasRoute.new_from_rails_route(rails_route: r) }
|
52
|
+
|
53
|
+
routes.select! { |route| route.docstring.tags.any? } if OasRails.config.include_mode == :with_tags
|
54
|
+
routes.select! { |route| route.docstring.tags.any? { |t| t.tag_name == "oas_include" } } if OasRails.config.include_mode == :explicit
|
55
|
+
routes
|
83
56
|
end
|
84
57
|
|
85
58
|
def valid_routes
|
data/lib/oas_rails/version.rb
CHANGED
data/lib/oas_rails.rb
CHANGED
@@ -90,7 +90,8 @@ module OasRails
|
|
90
90
|
'Endpoint Tags' => [:tags],
|
91
91
|
'Summary' => [:summary],
|
92
92
|
'No Auth' => [:no_auth],
|
93
|
-
'Auth methods' => [:auth, :with_types]
|
93
|
+
'Auth methods' => [:auth, :with_types],
|
94
|
+
'OAS Include' => [:oas_include]
|
94
95
|
}
|
95
96
|
yard_tags.each do |tag_name, (method_name, handler)|
|
96
97
|
::YARD::Tags::Library.define_tag(tag_name, method_name, handler)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oas_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a-chacon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: easy_talk
|