data_model 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +43 -34
- data/lib/data_model/builtin/hash.rb +10 -2
- data/lib/data_model/struct.rb +14 -3
- data/lib/data_model/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec442d524136b58a53447650cd644a801b6fd117c8329462745d8f3891409c72
|
4
|
+
data.tar.gz: 9de27ed2d8b6f079dcbd9def6fc7afe4b051a1ce307d9156bee0ddfdd473f811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87894d04c913e2c3e1e7af718553da465cdd5ea519c5c3b88d9fc3dcfd701852100a85b992a168041d772dcd726a0c691b47c8de5d916d329202a34e34f19cb
|
7
|
+
data.tar.gz: 65422078b7c9a5a9f0a11164e0722387d032a65a985bd7056d1d45157719797171a2b05482faa62b840006fe9fa1b42041b70495fec0c7840299407a5dd9153e
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
data_model (0.
|
4
|
+
data_model (0.5.0)
|
5
5
|
zeitwerk
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (7.0.
|
10
|
+
activesupport (7.0.6)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
@@ -15,8 +15,9 @@ GEM
|
|
15
15
|
ast (2.4.2)
|
16
16
|
coderay (1.1.3)
|
17
17
|
concurrent-ruby (1.2.2)
|
18
|
-
csv (3.2.
|
18
|
+
csv (3.2.7)
|
19
19
|
diff-lcs (1.5.0)
|
20
|
+
erubi (1.12.0)
|
20
21
|
ffi (1.15.5)
|
21
22
|
fileutils (1.7.1)
|
22
23
|
formatador (1.1.0)
|
@@ -32,7 +33,7 @@ GEM
|
|
32
33
|
guard-rake (1.0.0)
|
33
34
|
guard
|
34
35
|
rake
|
35
|
-
i18n (1.
|
36
|
+
i18n (1.14.1)
|
36
37
|
concurrent-ruby (~> 1.0)
|
37
38
|
json (2.6.3)
|
38
39
|
language_server-protocol (3.17.0.3)
|
@@ -40,63 +41,69 @@ GEM
|
|
40
41
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
41
42
|
rb-inotify (~> 0.9, >= 0.9.10)
|
42
43
|
logger (1.5.3)
|
43
|
-
lumberjack (1.2.
|
44
|
+
lumberjack (1.2.9)
|
44
45
|
method_source (1.0.0)
|
45
|
-
minitest (5.
|
46
|
+
minitest (5.19.0)
|
46
47
|
nenv (0.3.0)
|
47
48
|
netrc (0.11.0)
|
48
49
|
notiffany (0.1.3)
|
49
50
|
nenv (~> 0.1)
|
50
51
|
shellany (~> 0.0)
|
51
52
|
parallel (1.23.0)
|
52
|
-
parser (3.2.2.
|
53
|
+
parser (3.2.2.3)
|
53
54
|
ast (~> 2.4.1)
|
55
|
+
racc
|
56
|
+
prettier_print (1.2.1)
|
54
57
|
pry (0.14.2)
|
55
58
|
coderay (~> 1.1)
|
56
59
|
method_source (~> 1.0)
|
60
|
+
racc (1.7.1)
|
57
61
|
rainbow (3.1.1)
|
58
62
|
rake (13.0.6)
|
59
63
|
rb-fsevent (0.11.2)
|
60
64
|
rb-inotify (0.10.1)
|
61
65
|
ffi (~> 1.0)
|
62
|
-
rbi (0.0.
|
66
|
+
rbi (0.0.17)
|
63
67
|
ast
|
64
|
-
parser (>=
|
68
|
+
parser (>= 3.0.0)
|
65
69
|
sorbet-runtime (>= 0.5.9204)
|
66
|
-
unparser
|
67
|
-
rbs (3.1.
|
68
|
-
regexp_parser (2.8.
|
69
|
-
rexml (3.2.
|
70
|
-
rubocop (1.
|
70
|
+
unparser (>= 0.5.6)
|
71
|
+
rbs (3.1.3)
|
72
|
+
regexp_parser (2.8.1)
|
73
|
+
rexml (3.2.6)
|
74
|
+
rubocop (1.55.1)
|
71
75
|
json (~> 2.3)
|
76
|
+
language_server-protocol (>= 3.17.0)
|
72
77
|
parallel (~> 1.10)
|
73
|
-
parser (>= 3.2.
|
78
|
+
parser (>= 3.2.2.3)
|
74
79
|
rainbow (>= 2.2.2, < 4.0)
|
75
80
|
regexp_parser (>= 1.8, < 3.0)
|
76
81
|
rexml (>= 3.2.5, < 4.0)
|
77
|
-
rubocop-ast (>= 1.28.
|
82
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
78
83
|
ruby-progressbar (~> 1.7)
|
79
84
|
unicode-display_width (>= 2.4.0, < 3.0)
|
80
|
-
rubocop-ast (1.
|
85
|
+
rubocop-ast (1.29.0)
|
81
86
|
parser (>= 3.2.1.0)
|
82
87
|
ruby-progressbar (1.13.0)
|
83
|
-
rufo (0.16.
|
88
|
+
rufo (0.16.2)
|
84
89
|
securerandom (0.2.2)
|
85
90
|
shellany (0.0.1)
|
86
|
-
sorbet (0.5.
|
87
|
-
sorbet-static (= 0.5.
|
88
|
-
sorbet-runtime (0.5.
|
89
|
-
sorbet-static (0.5.
|
90
|
-
sorbet-static-and-runtime (0.5.
|
91
|
-
sorbet (= 0.5.
|
92
|
-
sorbet-runtime (= 0.5.
|
93
|
-
spoom (1.2.
|
91
|
+
sorbet (0.5.10950)
|
92
|
+
sorbet-static (= 0.5.10950)
|
93
|
+
sorbet-runtime (0.5.10950)
|
94
|
+
sorbet-static (0.5.10950-universal-darwin-22)
|
95
|
+
sorbet-static-and-runtime (0.5.10950)
|
96
|
+
sorbet (= 0.5.10950)
|
97
|
+
sorbet-runtime (= 0.5.10950)
|
98
|
+
spoom (1.2.2)
|
99
|
+
erubi (>= 1.10.0)
|
94
100
|
sorbet (>= 0.5.10187)
|
95
101
|
sorbet-runtime (>= 0.5.9204)
|
102
|
+
syntax_tree (>= 6.1.1)
|
96
103
|
thor (>= 0.19.2)
|
97
|
-
steep (1.
|
104
|
+
steep (1.5.2)
|
98
105
|
activesupport (>= 5.1)
|
99
|
-
concurrent-ruby (>= 1.
|
106
|
+
concurrent-ruby (>= 1.1.10)
|
100
107
|
csv (>= 3.0.9)
|
101
108
|
fileutils (>= 1.1.0)
|
102
109
|
json (>= 2.1.0)
|
@@ -105,12 +112,14 @@ GEM
|
|
105
112
|
logger (>= 1.3.0)
|
106
113
|
parser (>= 3.1)
|
107
114
|
rainbow (>= 2.2.2, < 4.0)
|
108
|
-
rbs (>=
|
115
|
+
rbs (>= 3.1.0)
|
109
116
|
securerandom (>= 0.1)
|
110
117
|
strscan (>= 1.0.0)
|
111
118
|
terminal-table (>= 2, < 4)
|
112
119
|
strscan (3.0.6)
|
113
|
-
|
120
|
+
syntax_tree (6.1.1)
|
121
|
+
prettier_print (>= 1.2.0)
|
122
|
+
tapioca (0.11.8)
|
114
123
|
bundler (>= 2.2.25)
|
115
124
|
netrc (>= 0.11.0)
|
116
125
|
parallel (>= 1.21.0)
|
@@ -121,18 +130,18 @@ GEM
|
|
121
130
|
yard-sorbet
|
122
131
|
terminal-table (3.0.2)
|
123
132
|
unicode-display_width (>= 1.1.1, < 3)
|
124
|
-
thor (1.2.
|
133
|
+
thor (1.2.2)
|
125
134
|
tzinfo (2.0.6)
|
126
135
|
concurrent-ruby (~> 1.0)
|
127
136
|
unicode-display_width (2.4.2)
|
128
|
-
unparser (0.6.
|
137
|
+
unparser (0.6.8)
|
129
138
|
diff-lcs (~> 1.3)
|
130
139
|
parser (>= 3.2.0)
|
131
140
|
yard (0.9.34)
|
132
141
|
yard-sorbet (0.8.1)
|
133
142
|
sorbet-runtime (>= 0.5)
|
134
143
|
yard (>= 0.9)
|
135
|
-
zeitwerk (2.6.
|
144
|
+
zeitwerk (2.6.11)
|
136
145
|
|
137
146
|
PLATFORMS
|
138
147
|
arm64-darwin-22
|
@@ -149,4 +158,4 @@ DEPENDENCIES
|
|
149
158
|
tapioca
|
150
159
|
|
151
160
|
BUNDLED WITH
|
152
|
-
2.4.
|
161
|
+
2.4.18
|
@@ -134,8 +134,16 @@ module DataModel
|
|
134
134
|
|
135
135
|
# detect extra keys then what is defined in the schema
|
136
136
|
if !args.open
|
137
|
-
|
138
|
-
|
137
|
+
found = []
|
138
|
+
for child_key in children.keys
|
139
|
+
for val_key in val.keys
|
140
|
+
if val_key.to_s == child_key.to_s # doing it this way to support symbols and strings
|
141
|
+
found << val_key
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
extra = val.keys - found
|
139
147
|
|
140
148
|
if !extra.empty?
|
141
149
|
errors.add(extra_keys_error(extra))
|
data/lib/data_model/struct.rb
CHANGED
@@ -96,11 +96,22 @@ module DataModel
|
|
96
96
|
send("#{k}=", v)
|
97
97
|
end
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
required_types = self.class.required_types
|
100
|
+
found = []
|
101
|
+
|
102
|
+
for req in required_types
|
103
|
+
for key in data.keys
|
104
|
+
if key.to_s == req.to_s
|
105
|
+
found << req
|
106
|
+
break
|
107
|
+
end
|
102
108
|
end
|
103
109
|
end
|
110
|
+
|
111
|
+
found = required_types - found
|
112
|
+
if !found.empty?
|
113
|
+
raise "Missing required fields: #{found.join(', ')}"
|
114
|
+
end
|
104
115
|
end
|
105
116
|
|
106
117
|
# convert struct to a hash
|
data/lib/data_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Briggs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.4.
|
223
|
+
rubygems_version: 3.4.18
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Define a model for your data
|