You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an example we have two different CDS files which have a reference to each other. If you now execute cds2types, the corresponding files are generated, however, they are currently incorrect because each is missing in import.
Here a simple Example:
BusinessTransactionPayload:
using {
managed,
cuid,
} from'@sap/cds/common';
using {entities.message.TransferDocument} from'./transfer-document';
namespaceentities.shadow;
entityBusinessTransactionPayload:managed {
key uuid:UUID;
transferDocumentUUID:UUID;
transferDocument:Association to one TransferDocumentontransferDocument.uuid=$self.transferDocumentUUID;
}
TransferDcoument
using {
managed,
cuid,
} from'@sap/cds/common';
using {entities.shadow.BusinessTransactionPayload} from'./business-transaction';
namespaceentities.message;
entityTransferDocument:managed {
key uuid:UUID;
toBusinessTransaction:Composition of many BusinessTransactionPayloadontoBusinessTransaction.transferDocumentUUID=$self.uuid;
}
The problem here is that the generated Typescript file can not find the reference to entities.message.ITransferDocument or entities.shadow.IBusinessTransactionPayload because these are both in separate generated files. When a import is manually added its working. Is this behavior intended?
Kind Regards
The text was updated successfully, but these errors were encountered:
+1. I investigated further and the import is actually added at one point, but is then removed during the formatting step because it isn't being used.
The problem really is that the type of the field is spelled out with the namespace before it (e.g. entities.message.ITransferDocument instead of just ITransferDocument) (as defined here).
But the import is done in the format import { ... entities ... } from './{full namespace}' (here)
The formatter doesn't care about invalid types, so it doesn't throw an error. It just silently does its job of removing (technically) unused imports.
Version used: 3.0.0
CDS Version: 6.3.2
As an example we have two different CDS files which have a reference to each other. If you now execute cds2types, the corresponding files are generated, however, they are currently incorrect because each is missing in import.
Here a simple Example:
BusinessTransactionPayload:
TransferDcoument
Compiles to
The problem here is that the generated Typescript file can not find the reference to
entities.message.ITransferDocument
orentities.shadow.IBusinessTransactionPayload
because these are both in separate generated files. When a import is manually added its working. Is this behavior intended?Kind Regards
The text was updated successfully, but these errors were encountered: