oas_rails 0.14.0 → 0.15.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/lib/oas_rails/builders/oas_route_builder.rb +1 -1
- data/lib/oas_rails/builders/path_item_builder.rb +2 -2
- data/lib/oas_rails/configuration.rb +15 -1
- data/lib/oas_rails/spec/path_item.rb +2 -2
- data/lib/oas_rails/spec/specification.rb +3 -3
- data/lib/oas_rails/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51597f283e58aada1720795784cf5b6afaf936bd384286674411526b58cb7a2
|
4
|
+
data.tar.gz: 1d595b156bc952b401f5c3d2354eb36e0d4eb0df5f1d3e51f1096f746a160abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55414ffff2265c00ca787c72533960b2c9c8ac9cc19fb0aa1607c290926d45f60a43bff77af86cb2e26210119228870b1c44c0725626e154cece570473524bc1
|
7
|
+
data.tar.gz: dd19ea6f05ec54ddc606f775e4635d4fccdc459e03cfbf2e1281232faad9dd04ff74f80da4287bae9b8742c2d18bd47d3bd28bf711a0b9c7f6f113c4789a4ab4
|
@@ -6,8 +6,8 @@ module OasRails
|
|
6
6
|
@path_item = Spec::PathItem.new(specification)
|
7
7
|
end
|
8
8
|
|
9
|
-
def from_path(path
|
10
|
-
route_extractor.host_routes_by_path(path).each do |oas_route|
|
9
|
+
def from_path(path)
|
10
|
+
OasRails.config.route_extractor.host_routes_by_path(path).each do |oas_route|
|
11
11
|
oas_route.verb.downcase.split("|").each do |v|
|
12
12
|
@path_item.add_operation(v, OperationBuilder.new(@specification).from_oas_route(oas_route).build)
|
13
13
|
end
|
@@ -15,7 +15,7 @@ module OasRails
|
|
15
15
|
:use_model_names,
|
16
16
|
:rapidoc_theme
|
17
17
|
|
18
|
-
attr_reader :servers, :tags, :security_schema, :include_mode, :response_body_of_default
|
18
|
+
attr_reader :servers, :tags, :security_schema, :include_mode, :response_body_of_default, :route_extractor
|
19
19
|
|
20
20
|
def initialize
|
21
21
|
@info = Spec::Info.new
|
@@ -38,6 +38,7 @@ module OasRails
|
|
38
38
|
@use_model_names = false
|
39
39
|
@rapidoc_theme = :rails
|
40
40
|
@include_mode = :all
|
41
|
+
@route_extractor = Extractors::RouteExtractor
|
41
42
|
|
42
43
|
@possible_default_responses.each do |response|
|
43
44
|
method_name = "response_body_of_#{response}="
|
@@ -74,6 +75,19 @@ module OasRails
|
|
74
75
|
@tags = value.map { |t| Spec::Tag.new(name: t[:name], description: t[:description]) }
|
75
76
|
end
|
76
77
|
|
78
|
+
def route_extractor=(value)
|
79
|
+
unless value.respond_to?(:host_routes) &&
|
80
|
+
value.respond_to?(:host_routes_by_path) &&
|
81
|
+
value.respond_to?(:clear_cache) &&
|
82
|
+
value.respond_to?(:host_paths) &&
|
83
|
+
value.respond_to?(:clean_route)
|
84
|
+
raise ArgumentError,
|
85
|
+
"Route extractor must have the following methods: host_routes, host_routes_by_path, clear_cache, host_paths, and clean_route"
|
86
|
+
end
|
87
|
+
|
88
|
+
@route_extractor = value
|
89
|
+
end
|
90
|
+
|
77
91
|
def excluded_columns_incoming
|
78
92
|
%i[id created_at updated_at deleted_at]
|
79
93
|
end
|
@@ -13,8 +13,8 @@ module OasRails
|
|
13
13
|
@delete = nil
|
14
14
|
end
|
15
15
|
|
16
|
-
def fill_from(path
|
17
|
-
route_extractor.host_routes_by_path(path).each do |oas_route|
|
16
|
+
def fill_from(path)
|
17
|
+
OasRails.config.route_extractor.host_routes_by_path(path).each do |oas_route|
|
18
18
|
add_operation(oas_route.verb.downcase, Spec::Operation.new(@specification).fill_from(oas_route))
|
19
19
|
end
|
20
20
|
|
@@ -20,8 +20,8 @@ module OasRails
|
|
20
20
|
@paths = Spec::Paths.new(self)
|
21
21
|
end
|
22
22
|
|
23
|
-
def build
|
24
|
-
route_extractor.host_paths.each do |path|
|
23
|
+
def build
|
24
|
+
OasRails.config.route_extractor.host_paths.each do |path|
|
25
25
|
@paths.add_path(path)
|
26
26
|
end
|
27
27
|
end
|
@@ -31,7 +31,7 @@ module OasRails
|
|
31
31
|
# @return [void]
|
32
32
|
def clear_cache
|
33
33
|
MethodSource.clear_cache
|
34
|
-
|
34
|
+
OasRails.config.route_extractor.clear_cache
|
35
35
|
end
|
36
36
|
|
37
37
|
def oas_fields
|
data/lib/oas_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oas_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a-chacon
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: easy_talk_two
|
@@ -131,7 +130,6 @@ licenses:
|
|
131
130
|
- GPL-3.0-only
|
132
131
|
metadata:
|
133
132
|
homepage_uri: https://github.com/a-chacon/oas_rails
|
134
|
-
post_install_message:
|
135
133
|
rdoc_options: []
|
136
134
|
require_paths:
|
137
135
|
- lib
|
@@ -146,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
144
|
- !ruby/object:Gem::Version
|
147
145
|
version: '0'
|
148
146
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
147
|
+
rubygems_version: 3.6.7
|
151
148
|
specification_version: 4
|
152
149
|
summary: OasRails is a Rails engine for generating automatic interactive documentation
|
153
150
|
for your Rails APIs.
|