Dear Colleagues,
I wanted to add an array attribute to one of my v2 oData model entity sets, something that should roughly look like that in the tree representation:
ExtensionField
ID: String;
Name: String;
....
PermittedActions: // (the array I am adding)
Name: String;
Description: String;
Here's what I've done in CDS in order to achieve that:
1. Introduced a new complex type
type Actions : many {
Name: String(32);
Text: String(64);
}
2. Added that new field to the extension field entity set definition:
entity ExtensionField as projection on PendingExtensionFields {
*,
null as Actions : Actions
...
}
That seems to do the trick in terms of creating the odata model; cds build runs smoothly and it seems to create exactly the entity set I want:
<ComplexType Name="mdo_Actions">
<Property Name="Name" Type="Edm.String" MaxLength="32"/>
<Property Name="Text" Type="Edm.String" MaxLength="64"/>
</ComplexType>
....
<EntityType Name="ExtensionFields">
<Key>
<PropertyRef Name="ObjectType"/>
...
</Key>
...
<Property Name="Actions" Type="Collection(mdo.manageBOTypes.mdo_Actions)" Nullable="false"/>
</EntityType>
But the good news end here unfortunately. Once I try to build the whole java backend, it crashes, during the plugin
cds-maven-plugin tries to create the necessary POJO classes.
I wouldn't want to go very deep into details here, the generated POJOs relate to other ones that are not properly
created and so the build fails
Did someone maybe have some similar experience already?
Thank you and best regards,
Kirill