sober_swag 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sober_swag/input_object.rb +7 -0
- data/lib/sober_swag/serializer/meta.rb +7 -6
- data/lib/sober_swag/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0e0e510ec9344738f12f01098f1d34557ac41c83dc966b4368b1407496b868
|
4
|
+
data.tar.gz: 50f62bed3de241407e3d16caaae632dc8af21781477ac7e212a60af71780c932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ad84a03ee992677593aeea1342ddbb1fb693d7f67ae6c9e3b31b8d5050aeda86d71f65390d906ade4d30e458cdb7717d3ef02d93f3e966a92e4fac63240e8e
|
7
|
+
data.tar.gz: 535711fae0cc27c5122f5873cf64901e571631d9d87ecc04d44420deb99ff173bf83c0b36cdd34ce44aa6a697cec643098a8784be2487c2f9619ea78b52b2754
|
@@ -13,9 +13,16 @@ module SoberSwag
|
|
13
13
|
# The name to use for this type in external documentation.
|
14
14
|
def identifier(arg = nil)
|
15
15
|
@identifier = arg if arg
|
16
|
+
|
16
17
|
@identifier || name.to_s.gsub('::', '.')
|
17
18
|
end
|
18
19
|
|
20
|
+
def meta(*args)
|
21
|
+
super(*args).tap do |result|
|
22
|
+
result.identifier(identifier) if result.is_a?(Class) # pass on identifier
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
def primitive(sym)
|
20
27
|
SoberSwag::Types.const_get(sym)
|
21
28
|
end
|
@@ -20,20 +20,21 @@ module SoberSwag
|
|
20
20
|
self.class.new(base, metadata.merge(hash))
|
21
21
|
end
|
22
22
|
|
23
|
-
##
|
24
|
-
# Delegates to `base`, adds metadata, pumbs identifiers
|
25
23
|
def lazy_type
|
26
|
-
@base.lazy_type.meta(**metadata)
|
24
|
+
@lazy_type ||= @base.lazy_type.meta(**metadata)
|
27
25
|
end
|
28
26
|
|
29
|
-
##
|
30
|
-
# Delegates to `base`, adds metadata, plumbs identifiers
|
31
27
|
def type
|
32
|
-
@base.type.meta(**metadata)
|
28
|
+
@type ||= @base.type.meta(**metadata)
|
33
29
|
end
|
34
30
|
|
35
31
|
def finalize_lazy_type!
|
36
32
|
@base.finalize_lazy_type!
|
33
|
+
# Using .meta on dry-struct returns a *new type* that wraps the old one.
|
34
|
+
# As such, we need to be a bit clever about when we tack on the identifier
|
35
|
+
# for this type.
|
36
|
+
lazy_type.identifier(@base.lazy_type.identifier)
|
37
|
+
type.identifier(@base.type.identifier)
|
37
38
|
end
|
38
39
|
|
39
40
|
def lazy_type?
|
data/lib/sober_swag/version.rb
CHANGED