explicit 0.2.9 → 0.2.10
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 +11 -0
- data/lib/explicit/type/any.rb +27 -0
- data/lib/explicit/type/float.rb +1 -1
- data/lib/explicit/type/integer.rb +1 -1
- data/lib/explicit/type/record.rb +5 -5
- data/lib/explicit/type/string.rb +3 -3
- data/lib/explicit/type.rb +5 -2
- data/lib/explicit/version.rb +1 -1
- data/lib/explicit.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1402d523d25704f0f739033b55f4b14fbc197608e8ce8ba383ba1f6d15a86893
|
4
|
+
data.tar.gz: 30a8117792bf24f897bd1d13ae193dcc9829a6bd3e0355d49470618226269ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b61da4ef8d7ea544b1cb777c18939c928d9fa8b78e014aba28c96573752b1339e00d5313d1cff7857eb15a1aef4184ccf1a76f324c1a2152d44070d8b98836f9
|
7
|
+
data.tar.gz: 0b6ab64beb50c209f31c73f5ff20eca41e8d97cfb448f61da5ff9eaf848e008cd1de2bc4b605d04d07f5c0e80b8d3d6c334d08256475c33a2570a5cfe4796227
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ documented types at runtime.
|
|
16
16
|
- [Adding request examples](#adding-request-examples)
|
17
17
|
7. Types
|
18
18
|
- [Agreement](#agreement)
|
19
|
+
- [Any](#any)
|
19
20
|
- [Array](#array)
|
20
21
|
- [BigDecimal](#big_decimal)
|
21
22
|
- [Boolean](#boolean)
|
@@ -404,6 +405,16 @@ A boolean that must always be true. Useful for terms of use or agreement
|
|
404
405
|
acceptances. The following values are accepted: `true`, `"true"`, `"on"`, `"1"`
|
405
406
|
and `1`.
|
406
407
|
|
408
|
+
### Any
|
409
|
+
|
410
|
+
```ruby
|
411
|
+
:any
|
412
|
+
```
|
413
|
+
|
414
|
+
Allows all values, including null. Useful when documenting a proxy that
|
415
|
+
responds with whatever value the other service returned.
|
416
|
+
|
417
|
+
|
407
418
|
### Array
|
408
419
|
|
409
420
|
```ruby
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Explicit::Type::Any < Explicit::Type
|
4
|
+
def validate(value)
|
5
|
+
[ :ok, value ]
|
6
|
+
end
|
7
|
+
|
8
|
+
concerning :Webpage do
|
9
|
+
def summary
|
10
|
+
"any"
|
11
|
+
end
|
12
|
+
|
13
|
+
def partial
|
14
|
+
"explicit/documentation/type/any"
|
15
|
+
end
|
16
|
+
|
17
|
+
def has_details?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
concerning :Swagger do
|
23
|
+
def swagger_schema
|
24
|
+
merge_base_swagger_schema({})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/explicit/type/float.rb
CHANGED
data/lib/explicit/type/record.rb
CHANGED
@@ -7,7 +7,7 @@ class Explicit::Type::Record < Explicit::Type
|
|
7
7
|
@attributes = attributes.to_h do |attribute_name, type|
|
8
8
|
type = Explicit::Type.build(type) if !type.is_a?(Explicit::Type)
|
9
9
|
|
10
|
-
[attribute_name, type]
|
10
|
+
[ attribute_name, type ]
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -28,9 +28,9 @@ class Explicit::Type::Record < Explicit::Type
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
return [:error, errors] if errors.any?
|
31
|
+
return [ :error, errors ] if errors.any?
|
32
32
|
|
33
|
-
[:ok, validated_data]
|
33
|
+
[ :ok, validated_data ]
|
34
34
|
end
|
35
35
|
|
36
36
|
def path_params_type
|
@@ -78,7 +78,7 @@ class Explicit::Type::Record < Explicit::Type
|
|
78
78
|
|
79
79
|
def swagger_schema
|
80
80
|
properties = attributes.to_h do |name, type|
|
81
|
-
[name, type.swagger_schema]
|
81
|
+
[ name, type.swagger_schema ]
|
82
82
|
end
|
83
83
|
|
84
84
|
required = attributes.filter_map do |name, type|
|
@@ -89,7 +89,7 @@ class Explicit::Type::Record < Explicit::Type
|
|
89
89
|
type: "object",
|
90
90
|
properties:,
|
91
91
|
required:
|
92
|
-
})
|
92
|
+
}.compact_blank)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
data/lib/explicit/type/string.rb
CHANGED
@@ -34,7 +34,7 @@ class Explicit::Type::String < Explicit::Type
|
|
34
34
|
return error_i18n("format", regex: format.inspect)
|
35
35
|
end
|
36
36
|
|
37
|
-
[:ok, value]
|
37
|
+
[ :ok, value ]
|
38
38
|
end
|
39
39
|
|
40
40
|
concerning :Webpage do
|
@@ -62,7 +62,7 @@ class Explicit::Type::String < Explicit::Type
|
|
62
62
|
empty == false ? swagger_i18n("string_not_empty") : nil,
|
63
63
|
downcase == true ? swagger_i18n("string_downcase") : nil
|
64
64
|
]
|
65
|
-
})
|
65
|
+
}.compact_blank)
|
66
66
|
end
|
67
67
|
end
|
68
|
-
end
|
68
|
+
end
|
data/lib/explicit/type.rb
CHANGED
@@ -5,6 +5,9 @@ class Explicit::Type
|
|
5
5
|
|
6
6
|
def self.build(type)
|
7
7
|
case type
|
8
|
+
in :any
|
9
|
+
Explicit::Type::Any.new
|
10
|
+
|
8
11
|
in :agreement
|
9
12
|
Explicit::Type::Agreement.new
|
10
13
|
|
@@ -156,8 +159,8 @@ class Explicit::Type
|
|
156
159
|
base_attributes = {
|
157
160
|
default: default_value,
|
158
161
|
description: formatted_description
|
159
|
-
}
|
162
|
+
}.compact_blank
|
160
163
|
|
161
|
-
base_attributes.merge(attributes)
|
164
|
+
base_attributes.merge(attributes)
|
162
165
|
end
|
163
166
|
end
|
data/lib/explicit/version.rb
CHANGED
data/lib/explicit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luiz Vasconcellos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/explicit/test_helper/example_recorder.rb
|
96
96
|
- lib/explicit/type.rb
|
97
97
|
- lib/explicit/type/agreement.rb
|
98
|
+
- lib/explicit/type/any.rb
|
98
99
|
- lib/explicit/type/array.rb
|
99
100
|
- lib/explicit/type/big_decimal.rb
|
100
101
|
- lib/explicit/type/boolean.rb
|