explicit 0.2.14 → 0.2.15
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/app/views/explicit/documentation/_page.html.erb +1 -1
- data/app/views/explicit/documentation/type/_big_decimal.html.erb +4 -0
- data/lib/explicit/documentation/output/swagger.rb +21 -2
- data/lib/explicit/documentation/output/webpage.rb +4 -3
- data/lib/explicit/documentation.rb +1 -1
- data/lib/explicit/type/big_decimal.rb +1 -1
- data/lib/explicit/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: de123083ab64bba09159b8980d3ceb0d838ded515e163d4360129fc7accd4a53
|
4
|
+
data.tar.gz: d221e834b71e4d45fec25800ec995bd1a5c25a14a973301047a3b9932033773b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a295c83d2df60e452d7088f04d83fb419820190fc6445b3f07593adb01344689d3a95758e1b98a37312cf24d54a6a8c5dbed834c4137f11f51cee2db5096e1
|
7
|
+
data.tar.gz: d731ecb3e2e3d305857fa522d6eb9b9889ee8223eff2201f85c8eb62ccd784e0cedabe5bfb1b6c2a56db3b21d64996cfbc001d8140cf55da8d0ac647e9fc4626
|
@@ -56,7 +56,7 @@
|
|
56
56
|
Version <%= version %>
|
57
57
|
</div>
|
58
58
|
<div class="p-1 w-1/2">
|
59
|
-
<%= link_to "https://petstore.swagger.io/?url=#{url_helpers.explicit_documentation_swagger_url(host:
|
59
|
+
<%= link_to "https://petstore.swagger.io/?url=#{url_helpers.explicit_documentation_swagger_url(host:)}", target: "_blank", class: "flex items-center justify-center gap-1 text-neutral-900" do %>
|
60
60
|
<span>Swagger</span>
|
61
61
|
|
62
62
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4">
|
@@ -43,10 +43,16 @@ module Explicit::Documentation::Output
|
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
46
|
-
def call(
|
46
|
+
def call(env)
|
47
|
+
return respond_cors_preflight_request if env["REQUEST_METHOD"] == "OPTIONS"
|
48
|
+
|
47
49
|
@swagger_document ||= swagger_document
|
48
50
|
|
49
|
-
|
51
|
+
headers = cors_access_control_headers.merge({
|
52
|
+
"Content-Type" => "application/json"
|
53
|
+
})
|
54
|
+
|
55
|
+
[ 200, headers, [ @swagger_document.to_json ] ]
|
50
56
|
end
|
51
57
|
|
52
58
|
def inspect
|
@@ -54,6 +60,19 @@ module Explicit::Documentation::Output
|
|
54
60
|
end
|
55
61
|
|
56
62
|
private
|
63
|
+
def respond_cors_preflight_request
|
64
|
+
[ 200, cors_access_control_headers, [] ]
|
65
|
+
end
|
66
|
+
|
67
|
+
def cors_access_control_headers
|
68
|
+
{
|
69
|
+
"Access-Control-Allow-Origin" => "*",
|
70
|
+
"Access-Control-Allow-Methods" => "GET, OPTIONS",
|
71
|
+
"Access-Control-Allow-Headers" => "Content-Type",
|
72
|
+
"Access-Control-Max-Age" => "86400"
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
57
76
|
def get_base_url
|
58
77
|
base_urls = builder.requests.map(&:get_base_url).uniq
|
59
78
|
base_paths = builder.requests.map(&:get_base_path).uniq
|
@@ -8,8 +8,8 @@ module Explicit::Documentation::Output
|
|
8
8
|
@builder = builder
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
@html ||= render_documentation_page
|
11
|
+
def call(env)
|
12
|
+
@html ||= render_documentation_page(host: env["HTTP_HOST"])
|
13
13
|
|
14
14
|
[200, {}, [@html]]
|
15
15
|
end
|
@@ -21,10 +21,11 @@ module Explicit::Documentation::Output
|
|
21
21
|
private
|
22
22
|
Eval = ->(value) { value.respond_to?(:call) ? value.call : value }
|
23
23
|
|
24
|
-
def render_documentation_page
|
24
|
+
def render_documentation_page(host:)
|
25
25
|
Explicit::ApplicationController.render(
|
26
26
|
partial: "explicit/documentation/page",
|
27
27
|
locals: {
|
28
|
+
host:,
|
28
29
|
url_helpers: @builder.rails_engine.routes.url_helpers,
|
29
30
|
page_title: Eval[builder.get_page_title],
|
30
31
|
company_logo_url: Eval[builder.get_company_logo_url],
|
@@ -17,7 +17,7 @@ module Explicit::Documentation
|
|
17
17
|
|
18
18
|
engine.routes.draw do
|
19
19
|
get "/", to: builder.webpage, as: :explicit_documentation_webpage
|
20
|
-
|
20
|
+
match "/swagger", to: builder.swagger, as: :explicit_documentation_swagger, via: [:get, :options]
|
21
21
|
end
|
22
22
|
|
23
23
|
engine
|
data/lib/explicit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: explicit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luiz Vasconcellos
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -128,7 +127,6 @@ metadata:
|
|
128
127
|
homepage_uri: https://github.com/luizpvas/explicit
|
129
128
|
source_code_uri: https://github.com/luizpvas/explicit
|
130
129
|
changelog_uri: https://github.com/luizpvas/explicit
|
131
|
-
post_install_message:
|
132
130
|
rdoc_options: []
|
133
131
|
require_paths:
|
134
132
|
- lib
|
@@ -143,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
141
|
- !ruby/object:Gem::Version
|
144
142
|
version: '0'
|
145
143
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
144
|
+
rubygems_version: 3.6.2
|
148
145
|
specification_version: 4
|
149
146
|
summary: Explicit is a validation and documentation library for REST APIs
|
150
147
|
test_files: []
|