Skip to content

Commit 8de73de

Browse files
committed
Add support for dashses in attribute names (tuple & relation types).
1 parent 59ad81c commit 8de73de

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# 0.10.1
1+
# 0.11.0
22

33
* Fix json schema generation of Boolean and union types with a |Nil
4+
* Add support for dashses in attribute names (tuple & relation types).
45

56
# 0.10.0 - 2021/01/11
67

features/finitio/language/types/tuple_type.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ Feature: Support for rich tuple types
1010
And `length` and `angle` are mandatory
1111
And it does not allow extra attributes
1212

13+
Scenario: Casing of the attribute names
14+
15+
Given the System is
16+
"""
17+
{ a-b: Integer, a_b: Integer, aB: Integer }
18+
"""
19+
Then it compiles to a tuple type
20+
1321
Scenario: Support for optional attributes
1422

1523
Given the System is

lib/finitio/syntax/lexer.citrus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ grammar Finitio::Syntax::Lexer
2121
end
2222

2323
rule attribute_name
24-
/[a-z_][a-zA-Z0-9_]*/
24+
/[a-z_][a-zA-Z0-9_\-]*/
2525
end
2626

2727
rule type_name

spec/syntax/nodes/test_attribute.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ module Finitio
3434
expect(compiled).not_to be_required
3535
end
3636
end
37+
38+
context 'when using dashes in attribute name' do
39+
let(:input){ 'created-at : .Integer' }
40+
41+
it 'works' do
42+
expect(compiled).to be_a(Attribute)
43+
expect(compiled.name).to eq(:"created-at")
44+
expect(compiled.type).to be_a(BuiltinType)
45+
expect(compiled.type.ruby_type).to be(Integer)
46+
expect(compiled).to be_required
47+
end
48+
end
3749
end
3850

3951
describe 'AST' do
@@ -60,6 +72,6 @@ module Finitio
6072
end
6173

6274
end
63-
75+
6476
end
6577
end

0 commit comments

Comments
 (0)