sapmentors / cap-community

SAP CAP Community
MIT License
97 stars 26 forks source link

SAP CAP Media handling annotations (BAS language compiler error) #118

Open edgar1506 opened 1 year ago

edgar1506 commented 1 year ago

Hello, I'm creating the following entity:

entity attachments : managed {
  key ID                : UUID;
      purchaseOrderId : String(36);
      content           : LargeBinary  @Core.MediaType   : mediaType  @Core.ContentDisposition.Filename : fileName  @Core.ContentDisposition.Type : 'inline';
      mediaType         : String(120)  @Core.IsMediaType : true;
      fileName          : String(120);
      size              : Integer;
      url               : String(240);
}

However BAS language compiler marks it in red and when I hover I get the following message:

Path mediaType leads to element. The path should lead to type Edm.String.CDS (annotations)

Apparently it's expecting the reference to mediaType to be a string, but according to the official documentation, the annotations are correct and the app works as expected, so I don't know why BAS is complaining.

Here is the result of executing cds --version:

@sap/cds: 6.6.0
@sap/cds-compiler: 3.7.2
@sap/cds-dk: 6.3.1
@sap/cds-foss: 4.0.0
@sap/cds-mtx: -- missing --
@sap/eslint-plugin-cds: 2.6.3
@sap/xssec: 3.2.17
Node.js: v16.19.0
cap-media-handling: 1.0.0