prauga-flexdoc 0.1.0 → 0.2.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 +3 -1
- data/assets/flexdoc.standalone.css +1 -1
- data/assets/flexdoc.standalone.js +48 -48
- data/lib/prauga/flexdoc/config.rb +39 -3
- data/lib/prauga/flexdoc/host.rb +7 -1
- data/lib/prauga/flexdoc/version.rb +1 -1
- metadata +2 -2
|
@@ -2,13 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
module Prauga
|
|
4
4
|
module FlexDoc
|
|
5
|
-
Config = Data.define(
|
|
6
|
-
|
|
5
|
+
Config = Data.define(
|
|
6
|
+
:path,
|
|
7
|
+
:spec_url,
|
|
8
|
+
:title,
|
|
9
|
+
:theme,
|
|
10
|
+
:try_it_enabled,
|
|
11
|
+
:expand,
|
|
12
|
+
:try_it_default_server,
|
|
13
|
+
:try_it_credentials,
|
|
14
|
+
:try_it_api_client_persistence_key
|
|
15
|
+
) do
|
|
16
|
+
def initialize(
|
|
17
|
+
path: "/docs",
|
|
18
|
+
spec_url: "/openapi.json",
|
|
19
|
+
title: "API Reference",
|
|
20
|
+
theme: "system",
|
|
21
|
+
try_it_enabled: true,
|
|
22
|
+
expand: nil,
|
|
23
|
+
try_it_default_server: nil,
|
|
24
|
+
try_it_credentials: nil,
|
|
25
|
+
try_it_api_client_persistence_key: nil
|
|
26
|
+
)
|
|
7
27
|
normalized = "/#{path.to_s.gsub(%r{\A/+|/+$}, "")}"
|
|
8
28
|
normalized = "/docs" if normalized == "/"
|
|
9
29
|
raise ArgumentError, "FlexDoc theme must be system, light, or dark" unless %w[system light dark].include?(theme)
|
|
30
|
+
if try_it_credentials && !%w[omit same-origin include].include?(try_it_credentials)
|
|
31
|
+
raise ArgumentError, "FlexDoc Try It credentials must be omit, same-origin, or include"
|
|
32
|
+
end
|
|
33
|
+
unless try_it_api_client_persistence_key.nil? || try_it_api_client_persistence_key == false || try_it_api_client_persistence_key.is_a?(String)
|
|
34
|
+
raise ArgumentError, "FlexDoc API Client persistence key must be a string, false, or nil"
|
|
35
|
+
end
|
|
10
36
|
|
|
11
|
-
super(
|
|
37
|
+
super(
|
|
38
|
+
path: normalized,
|
|
39
|
+
spec_url: spec_url,
|
|
40
|
+
title: title,
|
|
41
|
+
theme: theme,
|
|
42
|
+
try_it_enabled: !!try_it_enabled,
|
|
43
|
+
expand: expand,
|
|
44
|
+
try_it_default_server: try_it_default_server,
|
|
45
|
+
try_it_credentials: try_it_credentials,
|
|
46
|
+
try_it_api_client_persistence_key: try_it_api_client_persistence_key
|
|
47
|
+
)
|
|
12
48
|
end
|
|
13
49
|
end
|
|
14
50
|
end
|
data/lib/prauga/flexdoc/host.rb
CHANGED
|
@@ -28,12 +28,18 @@ module Prauga
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def documentation
|
|
31
|
+
try_it = { enabled: config.try_it_enabled }
|
|
32
|
+
try_it[:defaultServer] = config.try_it_default_server unless config.try_it_default_server.nil?
|
|
33
|
+
try_it[:credentials] = config.try_it_credentials unless config.try_it_credentials.nil?
|
|
34
|
+
try_it[:apiClientPersistenceKey] = config.try_it_api_client_persistence_key unless config.try_it_api_client_persistence_key.nil?
|
|
35
|
+
|
|
31
36
|
options = {
|
|
32
37
|
contractVersion: "1",
|
|
33
38
|
title: config.title,
|
|
34
39
|
theme: config.theme,
|
|
35
|
-
tryIt:
|
|
40
|
+
tryIt: try_it
|
|
36
41
|
}
|
|
42
|
+
options[:expand] = config.expand unless config.expand.nil?
|
|
37
43
|
title = CGI.escapeHTML(config.title.to_s)
|
|
38
44
|
path = CGI.escapeHTML(config.path)
|
|
39
45
|
spec_url = safe_json(config.spec_url)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prauga-flexdoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Prauga
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionpack
|