sorbet-schema 0.7.2 → 0.8.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/CHANGELOG.md +11 -0
- data/Gemfile.lock +1 -1
- data/lib/sorbet-schema/serialize_value.rb +1 -1
- data/lib/sorbet-schema/t/struct.rb +2 -0
- data/lib/sorbet-schema/version.rb +1 -1
- data/lib/typed/hash_serializer.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca60916d410548d1a3e628556255d5234b953d238d31de3c0177bc658b8b9516
|
|
4
|
+
data.tar.gz: ac60ef4cae335b0d97b2a6722f86447198d5fd2713ddb65b2f8ffec8bd1b8e5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d578b04600bab5767764a211507c8aaed6c6cf472ccad27e56ad1caddca3d3133f7ccdf12f2ebf1b3754cb017fc6a972782e992fa75ca2c1a16395ee9ea53497
|
|
7
|
+
data.tar.gz: 55fcfed95cb16ef9fe3d4ad9ad9fbd2513561eda0152c2d8346fdea370a68b64c3773787ca3c03067ed6ea033d638bb4f83557ea7de851126ad59ea3cc0ce39b
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.8.0](https://github.com/maxveldink/sorbet-schema/compare/v0.7.2...v0.8.0) (2024-07-19)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* Ensure that nested structs will deeply serialize ([#118](https://github.com/maxveldink/sorbet-schema/issues/118))
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* Ensure that nested structs will deeply serialize ([#118](https://github.com/maxveldink/sorbet-schema/issues/118)) ([9216d02](https://github.com/maxveldink/sorbet-schema/commit/9216d028fec806540ec6763ec941e1422eb30357))
|
|
17
|
+
|
|
7
18
|
## [0.7.2](https://github.com/maxveldink/sorbet-schema/compare/v0.7.1...v0.7.2) (2024-07-11)
|
|
8
19
|
|
|
9
20
|
|
data/Gemfile.lock
CHANGED
|
@@ -10,7 +10,7 @@ class SerializeValue
|
|
|
10
10
|
elsif value.is_a?(Array)
|
|
11
11
|
value.map { |item| serialize(item) }
|
|
12
12
|
elsif value.is_a?(T::Struct)
|
|
13
|
-
value.serialize_to(:
|
|
13
|
+
value.serialize_to(:deeply_nested_hash).payload_or(value)
|
|
14
14
|
elsif value.respond_to?(:serialize)
|
|
15
15
|
value.serialize
|
|
16
16
|
else
|
|
@@ -15,6 +15,8 @@ module T
|
|
|
15
15
|
sig { params(type: Symbol).returns(Typed::Serializer[T.untyped, T.untyped]) }
|
|
16
16
|
def serializer(type)
|
|
17
17
|
case type
|
|
18
|
+
when :deeply_nested_hash
|
|
19
|
+
Typed::HashSerializer.new(schema:, should_serialize_values: true)
|
|
18
20
|
when :hash
|
|
19
21
|
Typed::HashSerializer.new(schema:)
|
|
20
22
|
when :json
|
|
@@ -6,6 +6,9 @@ module Typed
|
|
|
6
6
|
Input = type_member { {fixed: InputHash} }
|
|
7
7
|
Output = type_member { {fixed: Params} }
|
|
8
8
|
|
|
9
|
+
sig { returns(T::Boolean) }
|
|
10
|
+
attr_reader :should_serialize_values
|
|
11
|
+
|
|
9
12
|
sig { params(schema: Schema, should_serialize_values: T::Boolean).void }
|
|
10
13
|
def initialize(schema:, should_serialize_values: false)
|
|
11
14
|
@should_serialize_values = should_serialize_values
|
|
@@ -24,10 +27,5 @@ module Typed
|
|
|
24
27
|
|
|
25
28
|
Success.new(serialize_from_struct(struct:, should_serialize_values:))
|
|
26
29
|
end
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
sig { returns(T::Boolean) }
|
|
31
|
-
attr_reader :should_serialize_values
|
|
32
30
|
end
|
|
33
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sorbet-schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Max VelDink
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-07-
|
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sorbet-result
|