Describe the bug
When using an inline attachment (Attachment) with an entity, and no Attachments composiotion is used elsewhere in the application, the object page of the entity is not enhanced with the facet for an inline attachemt.
(lcoal development using cds watch, likely not limited to local development)
To Reproduce
Steps to reproduce the behavior:
- Create an entity with an inline attachment.
using {cuid} from '@sap/cds/common';
using {Attachment, Attachments} from '@cap-js/attachments';
namespace sample
entity Invoices : cuid {
documentNumber : String;
// annotation causes file upload to fail
attachment : Attachment;
// Uncomment to trigger UI enhancement for attachments
// attachments : Composition of many Attachments;
}
annotate Invoices with @(
UI.LineItem: [
{Value: attachment_filename},
{Value: attachment_mimeType}
],
UI.Facets : [] // Required for plugin to add facets
)
- Expose the entity through a service definition
service AccountinService {
@odata.draft.enabled
entity Invoices as projection on my.Invoices;
}
- Start development preview (
cds watch)
- Open Fiori preview for
AccountingService.Invoices
- Create a new entity to open the object page
- UI Facet for inline attachment is not added to the object page
Uncommenting the attachments field leads to both facets for inline and compostion being added.
This is likey caused by the following line in unfoldModel (lib/plugin.js) only checking for sap.attachments.Attachments and not sap.attachments.Attachment as well:
if (!("sap.attachments.Attachments" in csn.definitions)) return
Expected behavior
When using a single inline attachment without another attachments composition in the application, the UI facet for the inline attachments should be added.
Screenshots
Missing facet:

Expected state:

Customer Info
Company: TUM project with SAP.
Describe the bug
When using an inline attachment (
Attachment) with an entity, and noAttachmentscomposiotion is used elsewhere in the application, the object page of the entity is not enhanced with the facet for an inline attachemt.(lcoal development using
cds watch, likely not limited to local development)To Reproduce
Steps to reproduce the behavior:
cds watch)AccountingService.InvoicesUncommenting the
attachmentsfield leads to both facets for inline and compostion being added.This is likey caused by the following line in
unfoldModel(lib/plugin.js) only checking forsap.attachments.Attachmentsand notsap.attachments.Attachmentas well:Expected behavior
When using a single inline attachment without another attachments composition in the application, the UI facet for the inline attachments should be added.
Screenshots
Missing facet:

Expected state:

Customer Info
Company: TUM project with SAP.