finitio 0.12.3 → 1.0.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 +43 -0
- data/Gemfile.lock +106 -79
- data/README.md +92 -6
- data/finitio.gemspec +17 -7
- data/lib/finitio/json_schema/union_type.rb +2 -2
- data/lib/finitio/stdlib/finitio/data.fio +1 -3
- data/lib/finitio/version.rb +3 -3
- data/spec/regression/test_stdlib_boolean_aliases.rb +29 -0
- data/tasks/gem.rake +3 -23
- metadata +27 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 773ca91089959227b7ee5b864a95cc48637b4fb18f4fb1ae7489742988329e26
|
|
4
|
+
data.tar.gz: 0b38248ce3c6e056518b77ce9c00e9bd66bcac640158ffe0264805f51a802555
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ce36dfe6508e4c62a9baf529766c738c4d7d8a9a25a4ee987f35b0c90ff371fc7d1cd7d45353b861b649349de2675851eabde6ef8a49079d33e68143667cb86
|
|
7
|
+
data.tar.gz: 2af8db58dd1cd14fc2b9e41362a214b4d30ba9165a2853c7a9294ffe3f373376bba83dfac2e2540c927d5b557b479cc3d3678f82c13edfde683a55ab8e620a17
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## 1.0.0 - 2026/08/06
|
|
2
|
+
|
|
3
|
+
This first major release does not reshape the language or the API: code
|
|
4
|
+
written against 0.12.3 keeps working, apart from the removal announced
|
|
5
|
+
below. It states that the public API is now stable, and that breaking
|
|
6
|
+
changes will be signalled by a major version bump from here on.
|
|
7
|
+
|
|
8
|
+
* BREAKING: the deprecated `Fixnum` and `Bignum` aliases are removed from
|
|
9
|
+
the `finitio/data` standard library. They had been aliases of `.Integer`
|
|
10
|
+
since 0.12.0, where their removal was announced. Use `Integer` instead.
|
|
11
|
+
|
|
12
|
+
* BREAKING: Ruby 3.2 is now the minimum supported version, and the test
|
|
13
|
+
grid covers 3.2, 3.3 and 3.4. Ruby 2.7 and 3.1 are both end-of-life.
|
|
14
|
+
|
|
15
|
+
* Fix the `FalseClass` alias of the `finitio/data` standard library, which
|
|
16
|
+
was defined as `.TrueClass`: it accepted `true` and rejected `false`.
|
|
17
|
+
The `False` alias was, and remains, correct. Schemas that worked around
|
|
18
|
+
the bug by writing `FalseClass` where they meant a true value must be
|
|
19
|
+
updated.
|
|
20
|
+
|
|
21
|
+
* Development dependencies are upgraded to their latest releases, notably
|
|
22
|
+
cucumber 11.1, activesupport 8.1 and simplecov 1.0 (through
|
|
23
|
+
`coveralls_reborn`, the unmaintained `coveralls` gem having pinned
|
|
24
|
+
simplecov to 0.16.1).
|
|
25
|
+
|
|
26
|
+
* Fix `rake test`, which was broken on Ruby 3.4: the gemspec was eval'd
|
|
27
|
+
without a filename, so `__FILE__` resolved to a bogus path when looking
|
|
28
|
+
up `Manifest.txt`.
|
|
29
|
+
|
|
30
|
+
* The dressing rule for extra attributes is now pinned by a feature: an
|
|
31
|
+
untyped `...` accepts extra attributes but constrains them in no way, so
|
|
32
|
+
they are dropped, while a typed `...: Age` guarantees their type and
|
|
33
|
+
keeps them.
|
|
34
|
+
|
|
35
|
+
* Integration tests now also run on pushes to master, not only on pull
|
|
36
|
+
requests targeting it.
|
|
37
|
+
|
|
38
|
+
* Remove `finitio.noespec`, the Noe template descriptor. It had not been
|
|
39
|
+
updated since 0.7.0 in 2019 and every value in it had gone stale, while
|
|
40
|
+
Noe itself is no longer a dependency of the project. `tasks/gem.rake`,
|
|
41
|
+
the only file still advertising itself as generated from it, is now
|
|
42
|
+
plainly hand-maintained.
|
|
43
|
+
|
|
1
44
|
## 0.12.3 - 2025/09/01
|
|
2
45
|
|
|
3
46
|
* Add Heading#project and (Multi)TupleType#project, to remove some attributes.
|
data/Gemfile.lock
CHANGED
|
@@ -1,122 +1,149 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
finitio (0.
|
|
4
|
+
finitio (1.0.0)
|
|
5
5
|
citrus (>= 3.0, < 4.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activesupport (
|
|
11
|
-
|
|
10
|
+
activesupport (8.1.3.1)
|
|
11
|
+
base64
|
|
12
|
+
bigdecimal
|
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
+
connection_pool (>= 2.2.5)
|
|
15
|
+
drb
|
|
12
16
|
i18n (>= 1.6, < 2)
|
|
17
|
+
json
|
|
18
|
+
logger (>= 1.4.2)
|
|
13
19
|
minitest (>= 5.1)
|
|
14
|
-
|
|
20
|
+
securerandom (>= 0.3)
|
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
+
uri (>= 0.13.1)
|
|
15
23
|
awesome_print (1.9.2)
|
|
16
|
-
|
|
24
|
+
base64 (0.3.0)
|
|
25
|
+
bigdecimal (4.1.2)
|
|
17
26
|
builder (3.3.0)
|
|
18
27
|
citrus (3.0.2)
|
|
19
|
-
concurrent-ruby (1.3.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
simplecov (
|
|
23
|
-
term-ansicolor (
|
|
24
|
-
thor (>=
|
|
25
|
-
tins (
|
|
26
|
-
cucumber (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cucumber-
|
|
30
|
-
cucumber-
|
|
31
|
-
cucumber-
|
|
32
|
-
cucumber-html-formatter (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
multi_test (~>
|
|
37
|
-
sys-uname (~> 1.
|
|
38
|
-
cucumber-
|
|
39
|
-
|
|
40
|
-
cucumber-
|
|
41
|
-
cucumber-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
cucumber-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
cucumber-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cucumber-messages (~> 12.2, >= 12.2.0)
|
|
57
|
-
diff-lcs (1.3)
|
|
58
|
-
docile (1.4.1)
|
|
59
|
-
ffi (1.17.2-x86_64-linux-gnu)
|
|
60
|
-
i18n (1.14.7)
|
|
28
|
+
concurrent-ruby (1.3.8)
|
|
29
|
+
connection_pool (3.0.2)
|
|
30
|
+
coveralls_reborn (1.0.0)
|
|
31
|
+
simplecov (>= 1.0)
|
|
32
|
+
term-ansicolor (>= 1.11)
|
|
33
|
+
thor (>= 1.5)
|
|
34
|
+
tins (>= 1.54)
|
|
35
|
+
cucumber (11.1.1)
|
|
36
|
+
base64 (~> 0.2)
|
|
37
|
+
builder (~> 3.2)
|
|
38
|
+
cucumber-ci-environment (> 9, < 12)
|
|
39
|
+
cucumber-core (>= 16.2.0, < 17)
|
|
40
|
+
cucumber-cucumber-expressions (> 17, < 20)
|
|
41
|
+
cucumber-html-formatter (> 21, < 24)
|
|
42
|
+
diff-lcs (~> 1.5)
|
|
43
|
+
logger (~> 1.6)
|
|
44
|
+
mini_mime (~> 1.1)
|
|
45
|
+
multi_test (~> 1.1)
|
|
46
|
+
sys-uname (~> 1.5)
|
|
47
|
+
cucumber-ci-environment (11.0.0)
|
|
48
|
+
cucumber-core (16.2.0)
|
|
49
|
+
cucumber-gherkin (> 36, < 40)
|
|
50
|
+
cucumber-messages (> 31, < 33)
|
|
51
|
+
cucumber-tag-expressions (> 6, < 9)
|
|
52
|
+
cucumber-cucumber-expressions (19.0.1)
|
|
53
|
+
bigdecimal
|
|
54
|
+
cucumber-gherkin (39.1.0)
|
|
55
|
+
cucumber-messages (>= 31, < 33)
|
|
56
|
+
cucumber-html-formatter (23.1.0)
|
|
57
|
+
cucumber-messages (> 23, < 33)
|
|
58
|
+
cucumber-messages (32.3.1)
|
|
59
|
+
cucumber-tag-expressions (8.1.0)
|
|
60
|
+
diff-lcs (1.6.2)
|
|
61
|
+
drb (2.2.3)
|
|
62
|
+
erb (6.0.7)
|
|
63
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
64
|
+
i18n (1.15.2)
|
|
61
65
|
concurrent-ruby (~> 1.0)
|
|
62
|
-
|
|
66
|
+
io-console (0.8.2)
|
|
67
|
+
irb (1.18.0)
|
|
68
|
+
pp (>= 0.6.0)
|
|
69
|
+
prism (>= 1.3.0)
|
|
70
|
+
rdoc (>= 4.0.0)
|
|
71
|
+
reline (>= 0.4.2)
|
|
72
|
+
json (2.21.2)
|
|
73
|
+
logger (1.7.0)
|
|
63
74
|
memoist3 (1.0.0)
|
|
64
|
-
|
|
65
|
-
minitest (
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
mini_mime (1.1.5)
|
|
76
|
+
minitest (6.0.6)
|
|
77
|
+
drb (~> 2.0)
|
|
78
|
+
prism (~> 1.5)
|
|
79
|
+
mize (0.6.1)
|
|
80
|
+
multi_json (1.21.1)
|
|
81
|
+
multi_test (1.1.0)
|
|
68
82
|
path (2.1.0)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
pp (0.6.4)
|
|
84
|
+
prettyprint
|
|
85
|
+
prettyprint (0.2.0)
|
|
86
|
+
prism (1.9.0)
|
|
87
|
+
rake (13.4.2)
|
|
88
|
+
rbs (4.1.2)
|
|
89
|
+
logger
|
|
90
|
+
prism (>= 1.6.0)
|
|
91
|
+
tsort
|
|
92
|
+
rdoc (8.0.0)
|
|
93
|
+
erb
|
|
94
|
+
prism (>= 1.6.0)
|
|
95
|
+
rbs (>= 4.0.0)
|
|
96
|
+
tsort
|
|
97
|
+
readline (0.0.4)
|
|
98
|
+
reline
|
|
99
|
+
reline (0.6.3)
|
|
100
|
+
io-console (~> 0.5)
|
|
101
|
+
rspec (3.13.2)
|
|
76
102
|
rspec-core (~> 3.13.0)
|
|
77
103
|
rspec-expectations (~> 3.13.0)
|
|
78
104
|
rspec-mocks (~> 3.13.0)
|
|
79
|
-
rspec-core (3.13.
|
|
105
|
+
rspec-core (3.13.6)
|
|
80
106
|
rspec-support (~> 3.13.0)
|
|
81
107
|
rspec-expectations (3.13.5)
|
|
82
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
83
109
|
rspec-support (~> 3.13.0)
|
|
84
|
-
rspec-mocks (3.13.
|
|
110
|
+
rspec-mocks (3.13.8)
|
|
85
111
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
86
112
|
rspec-support (~> 3.13.0)
|
|
87
|
-
rspec-support (3.13.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
json (>= 1.8, < 3)
|
|
91
|
-
simplecov-html (~> 0.10.0)
|
|
92
|
-
simplecov-html (0.10.2)
|
|
113
|
+
rspec-support (3.13.7)
|
|
114
|
+
securerandom (0.4.1)
|
|
115
|
+
simplecov (1.0.3)
|
|
93
116
|
sync (0.5.0)
|
|
94
|
-
sys-uname (1.
|
|
117
|
+
sys-uname (1.5.1)
|
|
95
118
|
ffi (~> 1.1)
|
|
96
119
|
memoist3 (~> 1.0.0)
|
|
97
|
-
term-ansicolor (1.11.
|
|
98
|
-
tins (~> 1
|
|
99
|
-
thor (1.
|
|
100
|
-
|
|
101
|
-
tins (1.42.0)
|
|
120
|
+
term-ansicolor (1.11.3)
|
|
121
|
+
tins (~> 1)
|
|
122
|
+
thor (1.5.0)
|
|
123
|
+
tins (1.56.0)
|
|
102
124
|
bigdecimal
|
|
125
|
+
irb
|
|
126
|
+
mize (~> 0.6)
|
|
127
|
+
readline
|
|
103
128
|
sync
|
|
129
|
+
tsort (0.2.0)
|
|
104
130
|
tzinfo (2.0.6)
|
|
105
131
|
concurrent-ruby (~> 1.0)
|
|
132
|
+
uri (1.1.1)
|
|
106
133
|
|
|
107
134
|
PLATFORMS
|
|
108
135
|
x86_64-linux
|
|
109
136
|
|
|
110
137
|
DEPENDENCIES
|
|
111
|
-
activesupport (~>
|
|
112
|
-
awesome_print (~> 1.
|
|
113
|
-
|
|
114
|
-
cucumber (~>
|
|
138
|
+
activesupport (~> 8.1)
|
|
139
|
+
awesome_print (~> 1.9)
|
|
140
|
+
coveralls_reborn (~> 1.0)
|
|
141
|
+
cucumber (~> 11.1)
|
|
115
142
|
finitio!
|
|
116
143
|
multi_json (~> 1.15)
|
|
117
144
|
path (>= 2.1, < 3.0)
|
|
118
|
-
rake (~> 13.
|
|
119
|
-
rspec (~> 3.
|
|
145
|
+
rake (~> 13.2)
|
|
146
|
+
rspec (~> 3.13)
|
|
120
147
|
|
|
121
148
|
BUNDLED WITH
|
|
122
149
|
2.4.19
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[](https://github.com/enspirit/finitio-rb/actions/workflows/integration.yml)
|
|
2
|
+
[](https://rubygems.org/gems/finitio)
|
|
3
|
+
[](https://coveralls.io/github/enspirit/finitio-rb?branch=master)
|
|
4
4
|
|
|
5
5
|
# Finitio(-rb)
|
|
6
6
|
|
|
@@ -11,6 +11,21 @@ schema" but the right way. For more information about *Finitio* itself, see
|
|
|
11
11
|
`finitio-rb` is the ruby binding of *Finitio*. It allows defining data schemas
|
|
12
12
|
and validating and coercing data against them in an idiomatic ruby way.
|
|
13
13
|
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
gem install finitio
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or, in a `Gemfile`:
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
gem 'finitio', '~> 1.0'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`finitio-rb` requires Ruby 3.2 or later, and is tested against 3.2, 3.3 and
|
|
27
|
+
3.4.
|
|
28
|
+
|
|
14
29
|
## Example
|
|
15
30
|
|
|
16
31
|
```ruby
|
|
@@ -29,13 +44,22 @@ FIO
|
|
|
29
44
|
|
|
30
45
|
# Let load some JSON document
|
|
31
46
|
data = JSON.parse <<-JSON
|
|
32
|
-
{ "name": "Finitio", "at": "
|
|
47
|
+
{ "name": "Finitio", "at": "2014-03-01T12:00:00Z" }
|
|
33
48
|
JSON
|
|
34
49
|
|
|
35
50
|
# And try dressing that data
|
|
36
51
|
puts schema.dress(data)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
Dressing either returns the data coerced to its ruby representation -- here,
|
|
55
|
+
`at` comes back as a real `DateTime` -- or raises a `Finitio::TypeError`
|
|
56
|
+
explaining what does not match:
|
|
57
|
+
|
|
58
|
+
```ruby
|
|
59
|
+
schema.dress({ "name" => " ", "at" => "2014-03-01T12:00:00Z" })
|
|
60
|
+
# => Finitio::TypeError: Invalid Default ` `
|
|
61
|
+
```
|
|
62
|
+
|
|
39
63
|
## ADTs with internal contracts
|
|
40
64
|
|
|
41
65
|
`finitio-rb` tries to provide an idiomatic binding for ruby developers. In
|
|
@@ -112,7 +136,7 @@ Posint = .Integer(i | i >= 0)
|
|
|
112
136
|
|
|
113
137
|
```
|
|
114
138
|
# parent.fio
|
|
115
|
-
@import ./child
|
|
139
|
+
@import ./child
|
|
116
140
|
|
|
117
141
|
# Child's types are available inside the system, but not outside it, that
|
|
118
142
|
# is, imported types are not themselves exported
|
|
@@ -120,7 +144,7 @@ Byte = Posint(i | i <= 255 )
|
|
|
120
144
|
```
|
|
121
145
|
|
|
122
146
|
```
|
|
123
|
-
@import ./parent
|
|
147
|
+
@import ./parent
|
|
124
148
|
|
|
125
149
|
# This will work
|
|
126
150
|
HalfByte = Byte(i | i <= 128)
|
|
@@ -129,6 +153,14 @@ HalfByte = Byte(i | i <= 128)
|
|
|
129
153
|
Posint(i | i <= 128)
|
|
130
154
|
```
|
|
131
155
|
|
|
156
|
+
Note that the path is written **without** the `.fio` extension: the resolver
|
|
157
|
+
appends it, so `@import ./child.fio` looks for `child.fio.fio` and fails.
|
|
158
|
+
|
|
159
|
+
Relative paths are resolved against the file the system was loaded from, so
|
|
160
|
+
the schema has to come from one — `Finitio.system(Pathname.new('parent.fio'))`
|
|
161
|
+
rather than `Finitio.system(File.read('parent.fio'))`, which has no path to
|
|
162
|
+
resolve against.
|
|
163
|
+
|
|
132
164
|
See the next section about the standard library if you need to share types
|
|
133
165
|
without relying on relative paths.
|
|
134
166
|
|
|
@@ -184,6 +216,60 @@ Then, a Finitio schema will have access to the types defined in your extension:
|
|
|
184
216
|
@import myrubygem/advanced
|
|
185
217
|
```
|
|
186
218
|
|
|
219
|
+
## Generating a JSON Schema
|
|
220
|
+
|
|
221
|
+
Finitio types can be projected to a JSON Schema, which is useful to expose a
|
|
222
|
+
schema to consumers that do not speak Finitio (API documentation, client-side
|
|
223
|
+
validation, ...). The feature ships in a separate file, to be required
|
|
224
|
+
explicitly:
|
|
225
|
+
|
|
226
|
+
```ruby
|
|
227
|
+
require 'finitio'
|
|
228
|
+
require 'finitio/json_schema'
|
|
229
|
+
|
|
230
|
+
schema = Finitio.system <<-FIO
|
|
231
|
+
@import finitio/data
|
|
232
|
+
|
|
233
|
+
Person = { name: String, age: Integer }
|
|
234
|
+
Person
|
|
235
|
+
FIO
|
|
236
|
+
|
|
237
|
+
schema.fetch('Person').to_json_schema
|
|
238
|
+
# => {
|
|
239
|
+
# => type: "object",
|
|
240
|
+
# => properties: {
|
|
241
|
+
# => name: { type: "string" },
|
|
242
|
+
# => age: { type: "integer" }
|
|
243
|
+
# => },
|
|
244
|
+
# => required: ["name", "age"]
|
|
245
|
+
# => }
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The projection is necessarily lossy: JSON Schema cannot express Finitio's
|
|
249
|
+
constraints, ADTs or recursive types faithfully. Two metadata attributes let
|
|
250
|
+
you steer it:
|
|
251
|
+
|
|
252
|
+
* `description` on an attribute is carried over to the generated schema.
|
|
253
|
+
* `jsonSchemaType` on a type stops the generation there and uses the given
|
|
254
|
+
type as-is, which is the way out for types that have no useful projection.
|
|
255
|
+
|
|
256
|
+
## Generating data
|
|
257
|
+
|
|
258
|
+
`Finitio::Generation` produces random data conforming to a type, which is
|
|
259
|
+
handy for tests and fixtures:
|
|
260
|
+
|
|
261
|
+
```ruby
|
|
262
|
+
require 'finitio'
|
|
263
|
+
require 'finitio/generation'
|
|
264
|
+
|
|
265
|
+
Finitio::Generation.new.call(schema.fetch('Person'))
|
|
266
|
+
# => { name: "e6f4a1c0b2d3", age: 418561 }
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Generation can be fine-tuned by passing generators by type name, or through
|
|
270
|
+
`examples` metadata on the type definitions themselves. See
|
|
271
|
+
`lib/finitio/generation.rb` for the available options.
|
|
272
|
+
|
|
187
273
|
## About representations
|
|
188
274
|
|
|
189
275
|
The `Rep` representation function mapping *Finitio* types to ruby classes is
|
data/finitio.gemspec
CHANGED
|
@@ -7,9 +7,17 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.version = $version
|
|
8
8
|
s.summary = "Finitio - in Ruby"
|
|
9
9
|
s.description = "Implements the Finitio information language in Ruby."
|
|
10
|
-
s.homepage = "https://
|
|
10
|
+
s.homepage = "https://www.finitio.io"
|
|
11
11
|
s.authors = ["Bernard Lambeau"]
|
|
12
12
|
s.email = ["blambeau@gmail.com"]
|
|
13
|
+
s.licenses = ["MIT"]
|
|
14
|
+
s.metadata = {
|
|
15
|
+
"homepage_uri" => "https://www.finitio.io",
|
|
16
|
+
"source_code_uri" => "https://github.com/enspirit/finitio-rb",
|
|
17
|
+
"changelog_uri" => "https://github.com/enspirit/finitio-rb/blob/master/CHANGELOG.md",
|
|
18
|
+
"bug_tracker_uri" => "https://github.com/enspirit/finitio-rb/issues",
|
|
19
|
+
"documentation_uri" => "https://www.finitio.io/reference/0.4.x/type-system",
|
|
20
|
+
}
|
|
13
21
|
s.require_paths = ["lib"]
|
|
14
22
|
here = File.expand_path(File.dirname(__FILE__))
|
|
15
23
|
s.files = File.readlines(File.join(here, 'Manifest.txt')).
|
|
@@ -20,15 +28,17 @@ Gem::Specification.new do |s|
|
|
|
20
28
|
s.bindir = "bin"
|
|
21
29
|
s.executables = (Dir["bin/*"]).collect{|f| File.basename(f)}
|
|
22
30
|
|
|
31
|
+
s.required_ruby_version = ">= 3.2"
|
|
32
|
+
|
|
23
33
|
s.add_dependency("citrus", ">= 3.0", "< 4.0")
|
|
24
34
|
|
|
25
|
-
s.add_development_dependency("rake", "~> 13.
|
|
26
|
-
s.add_development_dependency("rspec", "~> 3.
|
|
27
|
-
s.add_development_dependency("cucumber", "~>
|
|
28
|
-
s.add_development_dependency('activesupport', '~>
|
|
35
|
+
s.add_development_dependency("rake", "~> 13.2")
|
|
36
|
+
s.add_development_dependency("rspec", "~> 3.13")
|
|
37
|
+
s.add_development_dependency("cucumber", "~> 11.1")
|
|
38
|
+
s.add_development_dependency('activesupport', '~> 8.1')
|
|
29
39
|
s.add_development_dependency("path", ">= 2.1", "< 3.0")
|
|
30
|
-
s.add_development_dependency("awesome_print", "~> 1.
|
|
31
|
-
s.add_development_dependency("
|
|
40
|
+
s.add_development_dependency("awesome_print", "~> 1.9")
|
|
41
|
+
s.add_development_dependency("coveralls_reborn", "~> 1.0")
|
|
32
42
|
s.add_development_dependency("multi_json", "~> 1.15")
|
|
33
43
|
|
|
34
44
|
s.extensions = []
|
|
@@ -3,9 +3,9 @@ module Finitio
|
|
|
3
3
|
|
|
4
4
|
NIL_TYPE = BuiltinType.new(NilClass)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
TRUE_TYPE = BuiltinType.new(TrueClass)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
FALSE_TYPE = BuiltinType.new(FalseClass)
|
|
9
9
|
|
|
10
10
|
BOOLEAN_TYPE = UnionType.new([TRUE_TYPE, FALSE_TYPE])
|
|
11
11
|
|
|
@@ -4,15 +4,13 @@ Nil = .NilClass
|
|
|
4
4
|
|
|
5
5
|
# Booleans
|
|
6
6
|
TrueClass = .TrueClass
|
|
7
|
-
FalseClass = .
|
|
7
|
+
FalseClass = .FalseClass
|
|
8
8
|
True = .TrueClass
|
|
9
9
|
False = .FalseClass
|
|
10
10
|
Boolean = .TrueClass|.FalseClass
|
|
11
11
|
|
|
12
12
|
# Numbers
|
|
13
13
|
Numeric = .Numeric
|
|
14
|
-
Fixnum = .Integer
|
|
15
|
-
Bignum = .Integer
|
|
16
14
|
Integer = .Integer
|
|
17
15
|
Float = .Float
|
|
18
16
|
Real = .Float
|
data/lib/finitio/version.rb
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "The boolean aliases of the finitio/data stdlib" do
|
|
4
|
+
let(:schema){
|
|
5
|
+
Finitio.system <<~F
|
|
6
|
+
@import finitio/data
|
|
7
|
+
|
|
8
|
+
{ t: TrueClass, f: FalseClass, tt: True, ff: False, b: Boolean }
|
|
9
|
+
F
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
it 'dresses each alias with the value it stands for' do
|
|
13
|
+
expect(
|
|
14
|
+
schema.dress({t: true, f: false, tt: true, ff: false, b: true})
|
|
15
|
+
).to eql({t: true, f: false, tt: true, ff: false, b: true})
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'refuses true where a false is expected' do
|
|
19
|
+
expect(->(){
|
|
20
|
+
schema.dress({t: true, f: true, tt: true, ff: false, b: true})
|
|
21
|
+
}).to raise_error(Finitio::Error)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'refuses false where a true is expected' do
|
|
25
|
+
expect(->(){
|
|
26
|
+
schema.dress({t: false, f: false, tt: true, ff: false, b: true})
|
|
27
|
+
}).to raise_error(Finitio::Error)
|
|
28
|
+
end
|
|
29
|
+
end
|
data/tasks/gem.rake
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
# Installs rake tasks for gemming and packaging
|
|
2
2
|
#
|
|
3
|
-
# This file installs the 'rake package'
|
|
4
|
-
# (clobber_package, repackage, ...).
|
|
5
|
-
# from your .noespec file, and should therefore be configured there, under
|
|
6
|
-
# the variables/rake_tasks/gem entry, as illustrated below:
|
|
7
|
-
#
|
|
8
|
-
# variables:
|
|
9
|
-
# rake_tasks:
|
|
10
|
-
# gem:
|
|
11
|
-
# package_dir: pkg
|
|
12
|
-
# need_tar: false
|
|
13
|
-
# need_tar_gz: false
|
|
14
|
-
# need_tar_bz2: false
|
|
15
|
-
# need_zip: false
|
|
16
|
-
# ...
|
|
17
|
-
#
|
|
18
|
-
# If you have specific needs requiring manual intervention on this file,
|
|
19
|
-
# don't forget to set safe-override to false in your noe specification:
|
|
20
|
-
#
|
|
21
|
-
# template-info:
|
|
22
|
-
# manifest:
|
|
23
|
-
# tasks/gem.rake:
|
|
24
|
-
# safe-override: false
|
|
3
|
+
# This file installs the 'rake package' and 'rake gem' tasks and associates
|
|
4
|
+
# (clobber_package, repackage, ...). Edit it directly.
|
|
25
5
|
#
|
|
26
6
|
begin
|
|
27
7
|
require 'rubygems/package_task'
|
|
28
8
|
|
|
29
9
|
# Dynamically load the gem spec
|
|
30
10
|
gemspec_file = File.expand_path('../../finitio.gemspec', __FILE__)
|
|
31
|
-
gemspec = Kernel.eval(File.read(gemspec_file))
|
|
11
|
+
gemspec = Kernel.eval(File.read(gemspec_file), binding, gemspec_file)
|
|
32
12
|
|
|
33
13
|
Gem::PackageTask.new(gemspec) do |t|
|
|
34
14
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: finitio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bernard Lambeau
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: citrus
|
|
@@ -36,56 +36,56 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '13.
|
|
39
|
+
version: '13.2'
|
|
40
40
|
type: :development
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '13.
|
|
46
|
+
version: '13.2'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rspec
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '3.
|
|
53
|
+
version: '3.13'
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '3.
|
|
60
|
+
version: '3.13'
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: cucumber
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
67
|
+
version: '11.1'
|
|
68
68
|
type: :development
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
74
|
+
version: '11.1'
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
76
|
name: activesupport
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: '8.1'
|
|
82
82
|
type: :development
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: '8.1'
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
90
|
name: path
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -112,28 +112,28 @@ dependencies:
|
|
|
112
112
|
requirements:
|
|
113
113
|
- - "~>"
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: '1.
|
|
115
|
+
version: '1.9'
|
|
116
116
|
type: :development
|
|
117
117
|
prerelease: false
|
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
|
120
120
|
- - "~>"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '1.
|
|
122
|
+
version: '1.9'
|
|
123
123
|
- !ruby/object:Gem::Dependency
|
|
124
|
-
name:
|
|
124
|
+
name: coveralls_reborn
|
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
127
|
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '0
|
|
129
|
+
version: '1.0'
|
|
130
130
|
type: :development
|
|
131
131
|
prerelease: false
|
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - "~>"
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: '0
|
|
136
|
+
version: '1.0'
|
|
137
137
|
- !ruby/object:Gem::Dependency
|
|
138
138
|
name: multi_json
|
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -336,6 +336,7 @@ files:
|
|
|
336
336
|
- spec/regression/test_dress_on_recursive_type.rb
|
|
337
337
|
- spec/regression/test_heading_extra_are_proxy_resolved.rb
|
|
338
338
|
- spec/regression/test_name_of_generic_types.rb
|
|
339
|
+
- spec/regression/test_stdlib_boolean_aliases.rb
|
|
339
340
|
- spec/spec_helper.rb
|
|
340
341
|
- spec/support/test_compare_attrs.rb
|
|
341
342
|
- spec/support/test_proc_with_code.rb
|
|
@@ -484,9 +485,15 @@ files:
|
|
|
484
485
|
- spec/type_factory/factory/test_tuple_type.rb
|
|
485
486
|
- tasks/gem.rake
|
|
486
487
|
- tasks/test.rake
|
|
487
|
-
homepage: https://
|
|
488
|
-
licenses:
|
|
489
|
-
|
|
488
|
+
homepage: https://www.finitio.io
|
|
489
|
+
licenses:
|
|
490
|
+
- MIT
|
|
491
|
+
metadata:
|
|
492
|
+
homepage_uri: https://www.finitio.io
|
|
493
|
+
source_code_uri: https://github.com/enspirit/finitio-rb
|
|
494
|
+
changelog_uri: https://github.com/enspirit/finitio-rb/blob/master/CHANGELOG.md
|
|
495
|
+
bug_tracker_uri: https://github.com/enspirit/finitio-rb/issues
|
|
496
|
+
documentation_uri: https://www.finitio.io/reference/0.4.x/type-system
|
|
490
497
|
post_install_message:
|
|
491
498
|
rdoc_options: []
|
|
492
499
|
require_paths:
|
|
@@ -495,7 +502,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
495
502
|
requirements:
|
|
496
503
|
- - ">="
|
|
497
504
|
- !ruby/object:Gem::Version
|
|
498
|
-
version: '
|
|
505
|
+
version: '3.2'
|
|
499
506
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
500
507
|
requirements:
|
|
501
508
|
- - ">="
|
|
@@ -553,6 +560,7 @@ test_files:
|
|
|
553
560
|
- spec/regression/test_dress_on_recursive_type.rb
|
|
554
561
|
- spec/regression/test_heading_extra_are_proxy_resolved.rb
|
|
555
562
|
- spec/regression/test_name_of_generic_types.rb
|
|
563
|
+
- spec/regression/test_stdlib_boolean_aliases.rb
|
|
556
564
|
- spec/spec_helper.rb
|
|
557
565
|
- spec/support/test_compare_attrs.rb
|
|
558
566
|
- spec/support/test_proc_with_code.rb
|