Hi everyone,
I have a cds schema that has the composition entities defined inside the parent entity, for example:
entity Product : cuid {
type : StyleType;
style : Style;
categories : Composition of many {
key ID : UUID;
categoryType : String(1);
categoryNumber: String(1);
}
}
And I want to define an @assert.unique for ID up__ID and Category type :
@assert.unique.style : [ ID, up__ID, categoryType, categoryNumber, ]
But I get compile messages errors like this:
message: '“@assert.unique.style”: “categoryType” has not been found'.
If I define my categories entity outside and I define the @assert.unique.style like this:
entity Product : cuid {
type : StyleType;
style : Style;
categories : Composition of many Categories on categories.parent = $self
}
@assert.unique.style : [
parent,
categoryType,
categoryNumber,
]
entity Categories: cuid {
parent: Association to Product;
categoryType : String(1);
categoryNumber : String(1);
}
it works, but I want to know if it is possible to define it when the composition of many is not defined outside, because this will save me a lot of work to redefine my schema, views, etc.
Thanks,
Tatiana F.