dry_struct_generator 0.3.0 → 0.3.1

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: 0f196878c75b0e0ceb3838e9d3a7303b89160ad1c7d0913ba6cb8a01fa34d99f
4
- data.tar.gz: f8398420c20d49f0af901e36cd2123987c26a8f3e93c3c63952ebd47ea43d231
3
+ metadata.gz: 4d0d6d5dd24d3653c33ad38650935316dc58c1d3d447a11499525dbe3a4148d4
4
+ data.tar.gz: 145168f01e3a1d3bb9345f53a20a65a8291d2be9d38b2fce9945c6273b7770fc
5
5
  SHA512:
6
- metadata.gz: 380005d5b6779ce599c93bbd2b73c8535bec6621ad40dab4fb4746e5b406e53a9c3c0a84358f57fe7fde8c320d5cfc90fe04ee3d83660b23a23b12053ff9497d
7
- data.tar.gz: 070af2ad7edf12823626530e7e5e2fdb51737d21d1ada1776d66367af25b6160f2421fac6e8b29812f90a884ff8bb0301020d90dcc03824c1923b8f62f83f404
6
+ metadata.gz: 318b90e00f57a3671567d8b8d380c22631d7728f014e51761a90c960072e4b1f499d7f3c85540396e2c658c2451fdc9c23d722a842d5ec32a3f6080ee8fabdf1
7
+ data.tar.gz: d5bfbed3798ecd9648a1627fb1f991a74370455b12404abd1e2434d7b2f8cd84b9fbf7c8be2c746eda853aeda89a0d6323ec837ab2b62f7df501e7234997ae73
@@ -44,15 +44,20 @@ module DryStructGenerator
44
44
  def get_field_type(schema)
45
45
  if schema[:array]
46
46
  type = type_to_dry_type[:array]
47
- type = schema[:keys] ? type.of(generate(schema[:keys].to_sym)) : type.of(type_to_dry_type[schema[:type].to_sym])
47
+ if schema[:keys]
48
+ type = type.of(generate(schema[:keys].to_sym))
49
+ elsif schema[:type]
50
+ type = type.of(type_to_dry_type[schema[:type].to_sym])
51
+ end
48
52
  elsif schema[:keys]
49
53
  type = generate(schema[:keys])
50
54
  else
51
55
  type = type_to_dry_type[schema[:type].to_sym]
52
- type = type.optional if schema[:nullable]
53
- type = type.default(schema[:default]) if schema[:default]
54
56
  end
55
57
 
58
+ type = type.optional if schema[:nullable]
59
+ type = type.default(schema[:default].freeze) if schema[:default]
60
+
56
61
  type
57
62
  end
58
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DryStructGenerator
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_struct_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jane-Terziev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct