ree_lib 1.0.38 → 1.0.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f94479d9a955ba5ba5f65a8eba245bfab7c050b5a55e16a5de1773d920837bf
4
- data.tar.gz: e45a2a8f9166d4ed50d3cbc58a3bb73cb026adf3b09a8b32f64af986c1e15bdb
3
+ metadata.gz: 941b77c681e1913693fd1d61bbdb31f80a58a28c57d0449572326c00168d08f5
4
+ data.tar.gz: 618a3a1cb779993f53b089b53c701da7152bbc668a0e482687e44fbb5527ac57
5
5
  SHA512:
6
- metadata.gz: 93db2ec2423d53c97f2ae8a43e989f18c9d6d47e062686d1f89d9f45c58b90eca0778eb6c7ed20f1f16a35d85af7474e3a230f89f437d146817539626df25bbf
7
- data.tar.gz: fec05fa12a474168bc340ecf473a7cef26aa1ce8d7a0845e459c419228ddb954f52cacd35e4a4a58ca8ab7574218a47e274f55d4793e23c102801c81993b7c88
6
+ metadata.gz: 62b8cd78d133570a809a7c7c1ecec96223f9b92ffe018fb126891b016ede11f02d2efda8d50fea34323679d621544a83422100bf075e17fe97a6360c297fd2dd
7
+ data.tar.gz: 321b3a88a7d74b08bd5c9ebfc7820916fede0d196c0687615033fb4d8e08b198c013502fb8b88ae131ee963f578315986c12c779b782a38e7fb6d7d242c2fb9a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.38)
4
+ ree_lib (1.0.39)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -68,7 +68,7 @@ class ReeSwagger::TypeDefinitionsRepo
68
68
  ReeMapper::Array => ->(type, build_caster_schema) {
69
69
  {
70
70
  type: 'array',
71
- items: build_caster_schema.(type.of.type)
71
+ items: build_caster_schema.(type.subject.type)
72
72
  }
73
73
  },
74
74
  ReeMapper::DateTime => ->(*) {
@@ -1,6 +1,7 @@
1
1
  RSpec.describe :register_type do
2
2
  link :build_mapper_factory, from: :ree_mapper
3
3
  link :build_mapper_strategy, from: :ree_mapper
4
+ link :build_request_body_schema, from: :ree_swagger
4
5
  link :build_serializer_schema, from: :ree_swagger
5
6
  link :register_type, from: :ree_swagger
6
7
 
@@ -8,11 +9,16 @@ RSpec.describe :register_type do
8
9
  def serialize(obj, role: nil)
9
10
  obj.inspect
10
11
  end
12
+
13
+ def cast(obj, **)
14
+ obj
15
+ end
11
16
  end
12
17
 
13
18
  let(:mapper_factory) {
14
19
  strategies = [
15
20
  build_mapper_strategy(method: :serialize, dto: Hash),
21
+ build_mapper_strategy(method: :cast, dto: Hash),
16
22
  ]
17
23
 
18
24
  build_mapper_factory(strategies: strategies)
@@ -20,8 +26,9 @@ RSpec.describe :register_type do
20
26
  }
21
27
 
22
28
  let(:mapper) {
23
- mapper_factory.call.use(:serialize) do
29
+ mapper_factory.call.use(:serialize).use(:cast) do
24
30
  my_type :name
31
+ array :ids, integer
25
32
  end
26
33
  }
27
34
 
@@ -35,6 +42,16 @@ RSpec.describe :register_type do
35
42
  }
36
43
  }
37
44
  )
45
+
46
+ register_type(
47
+ :casters,
48
+ ReeSwagger::MyType,
49
+ ->(my_type, build_serializer_schema) {
50
+ {
51
+ type: 'string'
52
+ }
53
+ }
54
+ )
38
55
  end
39
56
 
40
57
  it {
@@ -44,7 +61,23 @@ RSpec.describe :register_type do
44
61
  properties: {
45
62
  name: {
46
63
  type: 'string'
47
- }
64
+ },
65
+ ids: { items: { type: "integer" }, type: "array" }
66
+ }
67
+ }
68
+ )
69
+ }
70
+
71
+ it {
72
+ expect(build_request_body_schema(mapper)).to eq(
73
+ {
74
+ type: 'object',
75
+ required: ["name", "ids"],
76
+ properties: {
77
+ name: {
78
+ type: 'string'
79
+ },
80
+ ids: { items: { type: "integer" }, type: "array" }
48
81
  }
49
82
  }
50
83
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.38"
4
+ VERSION = "1.0.39"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.38
4
+ version: 1.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-21 00:00:00.000000000 Z
11
+ date: 2023-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree