cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Localised Entities being shown in generated Open API

calmservices
Associate
Associate
0 Likes
1,870

Hi Colleagues,

I have a simple entity with one of the fields localized as show below in my service.cds file

entity Attributes : cuid {
contextType : Association to ContextTypes;
name : String(255);
description : localized String(500);
sequence : Integer;
}

I am using the following command in my POM to generate Open API Documentation
compile srv --service all -o docs/my_api --to openapi

The generated API Documentation has now both the Attributes and Attributes_texts. Is there a way to avoid displaying such entities having localized fields in Open API generated via CAP ? Because such entities have not been auto exposed (Attributes_texts) and only the parent entity has been (Attributes)

Accepted Solutions (0)

Answers (2)

Answers (2)

hjb
Product and Topic Expert
Product and Topic Expert
0 Likes

use

annotate Attributes.texts with @cds.autoexpose: false;
calmservices
Associate
Associate
0 Likes

Hi hans-joachim.both,

The entity Attributes_texts is an autogenerated one from the localised field in the Attribute entity. There is no entry for Attributes_texts in our service cds. This entity is generated during cds build. Hence we cannot explicitly annotate it with the @cds.autoexpose: false

Or am I missing something ? Should I add this somewhere in the parent Attribute entity ?

hjb
Product and Topic Expert
Product and Topic Expert
0 Likes

sure you can, I wrote 'Attributes.texts', not 'Attribute_texts', and of course you can't mute something that's inside a service already but only prevent an association target from becoming auto-exposed.

gregorw
SAP Mentor
SAP Mentor
0 Likes

Please check the documentation:

Omitting Elements from APIs

calmservices
Associate
Associate
0 Likes

Hi gregorw

I tried the following

I see the Attributes_Texts still coming up in the Open API. This Attributes_texts is a generated table which has a locale, ID and description (the column in attributes table which is localized)

gregorw
SAP Mentor
SAP Mentor
0 Likes

Have you tried adding the annotation to to the Attributes_texts entity?

hjb
Product and Topic Expert
Product and Topic Expert
0 Likes

that wouldn't help, the whole '.texts' entity should not become visible IIUC, see my answer below.