cancel
Showing results for 
Search instead for 
Did you mean: 

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

damovand
Product and Topic Expert
Product and Topic Expert

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 } ]}, });
damovand
Product and Topic Expert
Product and Topic Expert

Actually, I am finding some behavior with CAP that I cannot understand. The error above happens when I open annotations.cds file open in the editor but when I close it everything works fine!

After I close the file everything works fine.

AakashN24
Participant

Hello leila.lappin,

Facing the Same issue in CAP projects,

have you found any solution for the error.

Regards,

Aakash.

mpah
Explorer

Same thing here. Perfectly working and previously validated annotations are now showing the same issue, even though everything works when used.

Javier_Gomes
Newcomer

Same erro for me. Previously validated annotations are now showing this issue, please need an answer !!

asifalisap
Explorer

also facing Same Issue in annotation.cds file. but i try another app model it has no error like that. what is happening. ?? can anybody guide ??

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 Kudos

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
Employee
Employee
0 Kudos

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 Kudos

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/alert-notification-client@1.6.0
├── @sap-cloud-sdk/http-client@3.0.1
├── @sap/audit-logging@5.7.0
├── @sap/cds-dk@6.6.1
├── @sap/cds-mtxs@1.6.3
├── @sap/cds-odata-v2-adapter-proxy@1.9.20
├── @sap/cds@6.6.1
├── @sap/ux-specification@1.108.0
├── @sap/xsenv@3.4.0
├── @sap/xssec@3.2.17
├── axios@0.27.2
├── cds-swagger-ui-express@0.5.0
├── cf-nodejs-logging-support@6.14.1
├── cfenv@1.2.4
├── chai-as-promised@7.1.1
├── chai-subset@1.6.0
├── chai@4.3.7
├── debug@4.3.4
├── express@4.18.2
├── hdb@0.19.5
├── jest@29.5.0
├── node-fetch@2.6.9
├── node-jose@2.2.0
├── passport@0.6.0
└── sqlite3@5.1.6

Thank You in advance

Best regards

Attila

yijun_lin
Discoverer

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
Employee
Employee
0 Kudos

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
Discoverer

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