cancel
Showing results for 
Search instead for 
Did you mean: 

annotations.cds error: path should lead to type Edm.PrimitiveType.CDS

03-01-2023 12:39 AM
damovand Product and Topic Expert
4644 views 15 comments Go to solution
SAP Managed Tags
Subscribe

Hello,

I get the error Path title leads to element. The path should lead to type Edm.PrimitiveType.CDS (annotations) . It happens 9 times for every $Type : and value pair.

The strange thing is even with the error I still see Fiori preview rendering Risks correctly. However, Mitigations and BusinessPartners do not show anything on Fiori preview.

The following is my annotations.cds which is copied from the course content.

// using RiskService as service from '../../srv/risk-service';using RiskService from '../../srv/risk-service'; // Risk List Report Page annotate RiskService.Risks with @(UI : { HeaderInfo : { TypeName : 'Risk', TypeNamePlural : 'Risks', Title : { $Type : 'UI.DataField', Value : title, }, Description : { $Type : 'UI.DataField', Value : descr, } }, SelectionFields : [prio], Identification : [{Value : title}], // Define the table columns LineItem : [ {Value : title}, {Value : miti_ID}, {Value : owner}, {Value : bp_BusinessPartner}, { Value : prio, Criticality : criticality }, { Value : impact, Criticality : criticality }, ], }); // Risk Object Page annotate RiskService.Risks with @(UI : { Facets : [{ $Type : 'UI.ReferenceFacet', Label : 'Main', Target : '@UI.FieldGroup#Main', }], FieldGroup #Main : {Data : [ {Value : miti_ID}, {Value : owner}, {Value : bp_BusinessPartner}, { Value : prio, Criticality : criticality }, { Value : impact, Criticality : criticality } ]}, });

Accepted Solutions (1)

Accepted Solutions (1)

michaelschmid03
Explorer

In my Company, we have had this exact Issue. This is how you can fix it
1. Update the following package: npm install @sap/ux-cds-odata-language-server-extension
2. Delete the "SAP CDS Language Support" extension.
3. Close VS Code
4. in the Folder "C:\User\<User>\.vscode\extensions" delete the subfolder "sapse.vscode-cds-<version>"
5. Start VS Code and Install the Extension again.

This has resolved the issue for me and my colleagues.

Answers (1)

Answers (1)

Hi Leila,

the issue is due to changes in recent version of `@sap/cds-compiler` (presumably 3.7.2).

Validation of annotations is done in a separate npm module `@sap/ux-cds-odata-language-server-extension`. This module reacts to these changes in its next version (1.9.2) which should be available on npmjs.org in a few days.

It should be picked up from there automatically by the IDE (VSCode or BAS)

damovand
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Uwe,

Thank you for the clarifications. I was concerned I was doing something wrong and kept repeating the steps in the excercises. Thank you.

Best Regards,

Leila

maryana_naboka
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi leila.lappin,

the updated npm module v1.9.2 has just been released.

Hope this fixes your issue.

Best Regards,

Mariana

Attila
Active Participant
0 Likes

Hi maryana.naboka,

I am still facing the issue after restarting VSCode. Can You please tell, how I can fetch the updated modules mentioned above so that wrong syntax checks disappear ? I checked for updates in VScode also and disabled any CDS related 3rd part extensions.

I've deleted my node_modules folder and package-lock.json in the project root, then reinstalled node modules. However the situation is still the same.

I've the below version in my workspace, should I Increase here something ?

├── @sap_oss/[email protected]
├── @sap-cloud-sdk/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Thank You in advance

Best regards

Attila

yijun_lin
Associate
Associate

Hi Uwe Schwerk


I'm facing the same problems now. However, the error msg only appears in a few repos. I wonder if there were anything I coded by mistake but I can't find out what's the difference between my and others' repos.

Best regards,

Yijun

maryana_naboka
Product and Topic Expert
Product and Topic Expert
0 Likes

attila.berencsi

yijun.lin

In rare cases it is possible that the old version of the node module is cached and used instead of the new one.

In this case you can do the following:

1. Uninstall the SAP CDS Language Support extension

2. Delete the folder for this extension (e.g. sapse.vscode-cds-6.6.0) from the vscode extensions folder (e.g. /Users/<your user>/.vscode/extensions/)

3. Install the SAP CDS Language Support extension again

If you like, you can check which module version is used in your vscode. For that, please check the second line in the following file: /Users/<your user>/.vscode/extensions/sapse.vscode-cds-6.6.0/node_modules/@sap/cds-lsp/contributions/blue/node_modules/@sap/ux-cds-odata-language-server-extension/package.json

or

/Users/<your user>/.vscode/extensions/sapse.vscode-cds-6.6.0/node_modules/@sap/cds-lsp/contributions/green/node_modules/@sap/ux-cds-odata-language-server-extension

It should show "version": "1.9.2",

*using blue or green depends on the value set in file /Users/<your user>/.vscode/extensions/sapse.vscode-cds-6.6.0/node_modules/@sap/cds-lsp/contributions/active

frankmeertens
Explorer

Thanks, Mariana. Removing the extension and its folder worked for me.

yijun_lin
Associate
Associate

Works for me too. Thanks, Mariana.

Attila
Active Participant

Hi Mariana,

Thank You, it works! Seeing now red underline I can be sure that I did a mistake 🙂

Best regards, Attila

Ask a Question