kevoree-modeling-framework
kevoree-modeling-framework copied to clipboard
Unicity with @id is not guarantied
When you have this model:
class my.Foo {
members: my.Bar[0,*]
}
class my.Bar {
@id
name: String
}
You expect my.Foo.members
to act like a "Set" as it will only allow one and only one instance of my.Bar
with the id "unik" for instance.
But that's not the case currently:
Foo f = view.createFoo();
f.addMembers(view.createBar().setName("unik"));
f.addMembers(view.createBar().setName("unik"));
view.json().save(f, (model, e) -> System.out.println(model));
Outputs:
[
{
"@meta" : "my.Foo",
"@uuid" : "1",
"inputs": ["2","3"],
}
,{
"@meta" : "my.Bar",
"@uuid" : "2",
"@parent" : "1",
"@ref" : "my.Foo@members",
"@inbounds" : ["[email protected]@members"],
"name":"unik",
}
,{
"@meta" : "my.Bar",
"@uuid" : "3",
"@parent" : "1",
"@ref" : "my.Foo@members",
"@inbounds" : ["[email protected]@members"],
"name":"unik",
}
]
True, the @id in the add and in the compare is still not managed in KMFv4, will be extended soon