finitio 0.12.0 → 0.12.2
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 +13 -0
- data/Gemfile.lock +29 -26
- data/finitio.gemspec +1 -0
- data/lib/finitio/json_schema/ad_type.rb +4 -3
- data/lib/finitio/json_schema/builtin_type.rb +1 -0
- data/lib/finitio/json_schema/union_type.rb +3 -1
- data/lib/finitio/support/heading.rb +4 -0
- data/lib/finitio/type/hash_based_type.rb +4 -0
- data/lib/finitio/type/multi_tuple_type.rb +4 -0
- data/lib/finitio/type/tuple_type.rb +4 -0
- data/lib/finitio/version.rb +1 -1
- data/spec/json_schema/test_ad_type.rb +2 -2
- data/spec/json_schema/test_union_type.rb +12 -0
- data/spec/type/tuple_type/test_allbut.rb +17 -0
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dba23fcd08948c1ba59360fcedd3deb9eab5b7f92c49ad8849256da1964574c6
|
4
|
+
data.tar.gz: eaea92410902208a2c003fe34f3935604d4c464f4917e4bf06f7129fbfc24364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 890a227df66eef86898513ba4269863f603c3289c65bd65ff68b1cd6372b5d60b6ae726b46fc9d4c5c898dab78dbc50e124b84733bf6df176c5b4401803741a0
|
7
|
+
data.tar.gz: db438df7b731247174b40954c050893fba97d7db522e8b423bf5fb62a0075e44d6d3cb96ea5e58144416801e7ccabb8471e23ffdd1071d29ee790f9c5db1047f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.12.2 - 2025/03/22
|
2
|
+
|
3
|
+
* Add Heading#allbut and (Multi)TupleType#allbut, to remove some attributes.
|
4
|
+
|
5
|
+
This actually starts the support for an algebra on types...
|
6
|
+
|
7
|
+
* Don't generate anyOf with duplicate types in JsonSchema geneation.
|
8
|
+
|
9
|
+
## 0.12.1 - 2025/03/20
|
10
|
+
|
11
|
+
* Allow Hash as bulttin type recognized by JsonSchema generation.
|
12
|
+
* Remove Ruby 2.6 from supported versions. Requirement is Ruby 2.7.
|
13
|
+
|
1
14
|
## 0.12.0 - 2023/05/23
|
2
15
|
|
3
16
|
* Remove support for ruby < 2.6
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
finitio (0.12.
|
4
|
+
finitio (0.12.2)
|
5
5
|
citrus (>= 3.0, < 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (7.0.
|
10
|
+
activesupport (7.0.8.7)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
14
14
|
tzinfo (~> 2.0)
|
15
15
|
awesome_print (1.9.2)
|
16
|
-
|
16
|
+
bigdecimal (3.1.9)
|
17
|
+
builder (3.3.0)
|
17
18
|
citrus (3.0.2)
|
18
|
-
concurrent-ruby (1.
|
19
|
+
concurrent-ruby (1.3.5)
|
19
20
|
coveralls (0.8.23)
|
20
21
|
json (>= 1.8, < 3)
|
21
22
|
simplecov (~> 0.16.1)
|
@@ -54,13 +55,13 @@ GEM
|
|
54
55
|
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
55
56
|
cucumber-messages (~> 12.2, >= 12.2.0)
|
56
57
|
diff-lcs (1.3)
|
57
|
-
docile (1.4.
|
58
|
-
ffi (1.
|
59
|
-
i18n (1.
|
58
|
+
docile (1.4.1)
|
59
|
+
ffi (1.17.1-x86_64-linux-gnu)
|
60
|
+
i18n (1.14.7)
|
60
61
|
concurrent-ruby (~> 1.0)
|
61
|
-
json (2.
|
62
|
+
json (2.10.2)
|
62
63
|
middleware (0.1.0)
|
63
|
-
minitest (5.
|
64
|
+
minitest (5.25.5)
|
64
65
|
multi_json (1.15.0)
|
65
66
|
multi_test (0.1.2)
|
66
67
|
path (2.1.0)
|
@@ -69,33 +70,34 @@ GEM
|
|
69
70
|
middleware
|
70
71
|
thor
|
71
72
|
thread_safe
|
72
|
-
rake (13.
|
73
|
-
rspec (3.
|
74
|
-
rspec-core (~> 3.
|
75
|
-
rspec-expectations (~> 3.
|
76
|
-
rspec-mocks (~> 3.
|
77
|
-
rspec-core (3.
|
78
|
-
rspec-support (~> 3.
|
79
|
-
rspec-expectations (3.
|
73
|
+
rake (13.2.1)
|
74
|
+
rspec (3.13.0)
|
75
|
+
rspec-core (~> 3.13.0)
|
76
|
+
rspec-expectations (~> 3.13.0)
|
77
|
+
rspec-mocks (~> 3.13.0)
|
78
|
+
rspec-core (3.13.3)
|
79
|
+
rspec-support (~> 3.13.0)
|
80
|
+
rspec-expectations (3.13.3)
|
80
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.13.0)
|
83
|
+
rspec-mocks (3.13.2)
|
83
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
-
rspec-support (~> 3.
|
85
|
-
rspec-support (3.
|
85
|
+
rspec-support (~> 3.13.0)
|
86
|
+
rspec-support (3.13.2)
|
86
87
|
simplecov (0.16.1)
|
87
88
|
docile (~> 1.1)
|
88
89
|
json (>= 1.8, < 3)
|
89
90
|
simplecov-html (~> 0.10.0)
|
90
91
|
simplecov-html (0.10.2)
|
91
92
|
sync (0.5.0)
|
92
|
-
sys-uname (1.
|
93
|
+
sys-uname (1.3.1)
|
93
94
|
ffi (~> 1.1)
|
94
|
-
term-ansicolor (1.
|
95
|
+
term-ansicolor (1.11.2)
|
95
96
|
tins (~> 1.0)
|
96
|
-
thor (1.
|
97
|
+
thor (1.3.2)
|
97
98
|
thread_safe (0.3.6)
|
98
|
-
tins (1.
|
99
|
+
tins (1.38.0)
|
100
|
+
bigdecimal
|
99
101
|
sync
|
100
102
|
tzinfo (2.0.6)
|
101
103
|
concurrent-ruby (~> 1.0)
|
@@ -104,6 +106,7 @@ PLATFORMS
|
|
104
106
|
x86_64-linux
|
105
107
|
|
106
108
|
DEPENDENCIES
|
109
|
+
activesupport (~> 7.0.8)
|
107
110
|
awesome_print (~> 1.8)
|
108
111
|
coveralls (~> 0.8)
|
109
112
|
cucumber (~> 4.1)
|
@@ -114,4 +117,4 @@ DEPENDENCIES
|
|
114
117
|
rspec (~> 3.0)
|
115
118
|
|
116
119
|
BUNDLED WITH
|
117
|
-
2.
|
120
|
+
2.4.19
|
data/finitio.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency("rake", "~> 13.0")
|
26
26
|
s.add_development_dependency("rspec", "~> 3.0")
|
27
27
|
s.add_development_dependency("cucumber", "~> 4.1")
|
28
|
+
s.add_development_dependency('activesupport', '~> 7.0.8')
|
28
29
|
s.add_development_dependency("path", ">= 2.1", "< 3.0")
|
29
30
|
s.add_development_dependency("awesome_print", "~> 1.8")
|
30
31
|
s.add_development_dependency("coveralls", "~> 0.8")
|
@@ -2,9 +2,10 @@ module Finitio
|
|
2
2
|
class AdType
|
3
3
|
|
4
4
|
def to_json_schema(*args, &bl)
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
subtypes = contracts
|
6
|
+
.map{|c| c.infotype.to_json_schema(*args, &bl) }
|
7
|
+
.uniq
|
8
|
+
subtypes.size == 1 ? subtypes.first : { anyOf: subtypes }
|
8
9
|
end
|
9
10
|
|
10
11
|
end # class AdType
|
@@ -14,8 +14,10 @@ module Finitio
|
|
14
14
|
return { type: 'boolean'} if self == BOOLEAN_TYPE
|
15
15
|
return cs.first.to_json_schema(*args, &bl) if cs.size == 1
|
16
16
|
|
17
|
+
subtypes = cs.map{|c| c.to_json_schema(*args, &bl) }.uniq
|
18
|
+
return subtypes.first if subtypes.size == 1
|
17
19
|
{
|
18
|
-
anyOf:
|
20
|
+
anyOf: subtypes
|
19
21
|
}
|
20
22
|
end
|
21
23
|
|
@@ -114,6 +114,10 @@ module Finitio
|
|
114
114
|
Heading.new(attributes.values.map{|a| a.unconstrained }, options)
|
115
115
|
end
|
116
116
|
|
117
|
+
def allbut(attrs)
|
118
|
+
Heading.new(attributes.values.reject{|a| attrs.include?(a.name) }.to_a, @options)
|
119
|
+
end
|
120
|
+
|
117
121
|
private
|
118
122
|
|
119
123
|
def normalize_attributes(attrs)
|
data/lib/finitio/version.rb
CHANGED
@@ -3,10 +3,10 @@ module Finitio
|
|
3
3
|
describe "AdType" do
|
4
4
|
|
5
5
|
let(:type) {
|
6
|
-
type = AdType.new(Color, [rgb_contract, hex_contract])
|
6
|
+
type = AdType.new(Color, [rgb_contract, hex_contract, hex_contract])
|
7
7
|
}
|
8
8
|
|
9
|
-
it 'works as expected' do
|
9
|
+
it 'works as expected and removes duplicates' do
|
10
10
|
expect(type.to_json_schema).to eql({
|
11
11
|
anyOf: [
|
12
12
|
{ type: "integer" },
|
@@ -46,6 +46,18 @@ module Finitio
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
context 'when used with two yielding the same final type' do
|
50
|
+
let(:union_type) {
|
51
|
+
UnionType.new([string_type, string_type])
|
52
|
+
}
|
53
|
+
|
54
|
+
it 'works as expected' do
|
55
|
+
expect(union_type.to_json_schema).to eql({
|
56
|
+
:type => "string"
|
57
|
+
})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
49
61
|
context 'when used with a |Nil' do
|
50
62
|
let(:union_type) {
|
51
63
|
UnionType.new([string_type, int_type, nil_type])
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Finitio
|
3
|
+
describe TupleType, "allbut" do
|
4
|
+
|
5
|
+
let(:h1){ Heading.new([Attribute.new(:r, intType), Attribute.new(:b, intType)]) }
|
6
|
+
let(:h2){ Heading.new([Attribute.new(:b, intType)]) }
|
7
|
+
|
8
|
+
let(:t1) { TupleType.new(h1) }
|
9
|
+
let(:t2) { TupleType.new(h2) }
|
10
|
+
|
11
|
+
it 'removes unwanted atributes' do
|
12
|
+
expect(t1.allbut([:r])).to eql(t2)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
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.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citrus
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '4.1'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: activesupport
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 7.0.8
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 7.0.8
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: path
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -432,6 +446,7 @@ files:
|
|
432
446
|
- spec/type/sub_type/test_name.rb
|
433
447
|
- spec/type/test_suppremum.rb
|
434
448
|
- spec/type/test_unconstrained.rb
|
449
|
+
- spec/type/tuple_type/test_allbut.rb
|
435
450
|
- spec/type/tuple_type/test_default_name.rb
|
436
451
|
- spec/type/tuple_type/test_dress.rb
|
437
452
|
- spec/type/tuple_type/test_equality.rb
|
@@ -471,7 +486,7 @@ files:
|
|
471
486
|
homepage: https://github.com/blambeau/finitio
|
472
487
|
licenses: []
|
473
488
|
metadata: {}
|
474
|
-
post_install_message:
|
489
|
+
post_install_message:
|
475
490
|
rdoc_options: []
|
476
491
|
require_paths:
|
477
492
|
- lib
|
@@ -486,8 +501,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
501
|
- !ruby/object:Gem::Version
|
487
502
|
version: '0'
|
488
503
|
requirements: []
|
489
|
-
rubygems_version: 3.
|
490
|
-
signing_key:
|
504
|
+
rubygems_version: 3.4.19
|
505
|
+
signing_key:
|
491
506
|
specification_version: 4
|
492
507
|
summary: Finitio - in Ruby
|
493
508
|
test_files:
|
@@ -647,6 +662,7 @@ test_files:
|
|
647
662
|
- spec/type/sub_type/test_name.rb
|
648
663
|
- spec/type/test_suppremum.rb
|
649
664
|
- spec/type/test_unconstrained.rb
|
665
|
+
- spec/type/tuple_type/test_allbut.rb
|
650
666
|
- spec/type/tuple_type/test_default_name.rb
|
651
667
|
- spec/type/tuple_type/test_dress.rb
|
652
668
|
- spec/type/tuple_type/test_equality.rb
|