I'm using @sap/cloud-sdk-generator 1.6.1
to generate a VDM (YY1_SALESDOCUMENT_CDS), translating it to CSN using edmx2csn to then use it in a .CDS file to exposed as OData service (named CustomSales).
The goal is to enhance the original YY1_SALESDOCUMENT_CDS with an extra field 'foobar', which works as expected. But it has a draw back: CustomSales does not contains the metadata's sap:* attributes, like 'sap:label', that YY1_SALESDOCUMENT_CDS has.
My custom-sales.CDS service file:
using YY1_SALESDOCUMENT_CDS as sales from '../src/external/csn/YY1_SalesDocument.json';
service CustomSales {
@cds.persistence.skip
entity SalesDocument as projection on sales.YY1_SalesDocumentType {
*
} excluding {to_Item}
extend entity sales.YY1_SalesDocumentType with {
foobar: String(25) ;
toItem : Association to many SalesDocumentItem
on toItem.SalesDocument = SalesDocument ;
}
}
YY1_SALESDOCUMENT_CDS Service's metadata:
<EntityType Name="YY1_SalesDocumentType" sap:label="Sales Document" sap:content-version="1">
<Key>
<PropertyRef Name="SalesDocument"/>
</Key>
<Property Name="SalesDocument" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:required-in-filter="false" sap:label="Sales Document"/>
<NavigationProperty Name="to_Item"/>
</EntityType>
CustomSales Service's metadata:
<EntityType Name="SalesDocument">
<Key>
<PropertyRef Name="SalesDocument"/>
</Key>
<Property Name="SalesDocument" Type="Edm.String" MaxLength="10" Nullable="false"/>
<Property Name="foobar" Type="Edm.String" MaxLength="25"/>
<NavigationProperty Name="toItem" Type="Collection(CustomSales.SalesDocumentItem)"/>
</EntityType>
I expected all attributes from YY1_SALESDOCUMENT_CDS service to be copied over CustomSales, but that's not the case.
Is there a way to generate OData service from an existing service and also copy it's metadata attributes ?
It's worth mentioning that I'm using JS/TS as handler to custom logic, using the Cloud SDK for JS to call the original backend service.