cancel
Showing results for 
Search instead for 
Did you mean: 

Localised Entities being shown in generated Open API

calmservices
Discoverer
0 Kudos

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)

View Entire Topic
hjb
Advisor
Advisor
0 Kudos

use

annotate Attributes.texts with @cds.autoexpose: false;
calmservices
Discoverer
0 Kudos

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

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.