rswag-schema_components 0.1.5 → 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4a83a9214d990e259d26b551a5cec0c13d91c6ca42d0b452303854bd68ab04a
|
4
|
+
data.tar.gz: e212ca7db382ef8ae1b4c66a49e7c65ee3f6650ffe58e64989379d759b0c078c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491792f034575c3bda0d4e188a58fbe80ceae052c418f1342ebb18ecfaa96d615e7726c1c31d2e560ae3cbe7d4ab577695c0999db75a81a1256f0b595c4c615b
|
7
|
+
data.tar.gz: c613bd114d13304bc6627f3b6acf69707f56a877c12095c4b7216e20548e5a02acfd6118d6c8cc85f2fe9b3f5ab134dbc6ff6ab8e006600ebe7cab1db2fc0a53
|
@@ -7,7 +7,7 @@ module Rswag
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
class << self
|
10
|
-
attr_accessor :schema_value
|
10
|
+
attr_accessor :schema_value, :schema_hidden_value
|
11
11
|
|
12
12
|
def schema(schema_definition)
|
13
13
|
self.schema_value = if superclass.respond_to?(:schema_value)
|
@@ -17,11 +17,19 @@ module Rswag
|
|
17
17
|
schema_definition
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
def schema_hidden(flag = false)
|
22
|
+
self.schema_hidden_value = flag
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def to_schema
|
23
27
|
self.class.schema_value
|
24
28
|
end
|
29
|
+
|
30
|
+
def hidden?
|
31
|
+
self.class.schema_hidden_value
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -27,18 +27,29 @@ module Rswag
|
|
27
27
|
load_classes.each do |klass|
|
28
28
|
component_name = extract_component_name(klass)
|
29
29
|
|
30
|
-
|
30
|
+
component = klass.new
|
31
|
+
definition = component.to_schema
|
32
|
+
|
33
|
+
if component.hidden?
|
34
|
+
next
|
35
|
+
end
|
31
36
|
|
32
37
|
if components[component_name].present?
|
33
38
|
raise "Duplicate component name \"#{component_name}\" found in \"#{definitions_path}\""
|
34
39
|
end
|
35
40
|
|
36
|
-
|
41
|
+
definition = definition.merge(title: component_name) if type_allows_title?
|
42
|
+
|
43
|
+
components[component_name] = definition
|
37
44
|
end
|
38
45
|
|
39
46
|
components
|
40
47
|
end
|
41
48
|
|
49
|
+
private def type_allows_title?
|
50
|
+
type == "schemas"
|
51
|
+
end
|
52
|
+
|
42
53
|
private def load_classes
|
43
54
|
Dir.glob(base_path.join("#{definitions_path}/**/*")).filter_map do |file_path|
|
44
55
|
next if File.directory?(file_path)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rswag-schema_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Klitzke
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|