Support inline single attachments via Attachment type#768
Support inline single attachments via Attachment type#768busehalis-sap wants to merge 19 commits intomainfrom
Conversation
SummaryThe following content is AI-generated and provides a summary of the pull request: Support Inline Single Attachments via
|
There was a problem hiding this comment.
The PR introduces inline single-attachment support via the Attachment type, which is a meaningful extension of the existing composition-based approach. However, there are several substantive correctness issues that need attention before merging: a recurring "first prefix wins" bug across CreateAttachmentEvent, MarkAsDeletedAttachmentEvent, and DefaultAttachmentsServiceHandler that will produce wrong behavior for entities with more than one inline attachment field; an inverted/dead branch in ModifyApplicationHandlerHelper for contentId resolution; missing root-entity key columns in AttachmentsReader when both inline and expand columns are present; and a conflation in ReadAttachmentsHandler.getAttachmentAssociations that incorrectly treats inline-only root entities as direct media association roots. These should be resolved before the feature is considered production-ready.
PR Bot Information
Version: 1.19.3 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
pull_request.opened - Correlation ID:
bbb28610-2bff-11f1-8fd9-1dd0dd2b50a5 - LLM:
anthropic--claude-4.6-sonnet
lisajulia
left a comment
There was a problem hiding this comment.
Thanks! 👍
Please update the README file as well 📖 - then I'll approve ;)
8a97051 to
f041e27
Compare
…e-attachments # Conflicts: # cds-feature-attachments/src/main/java/com/sap/cds/feature/attachments/service/malware/DefaultAttachmentMalwareScanner.java # cds-feature-attachments/src/test/java/com/sap/cds/feature/attachments/handler/applicationservice/helper/ReadonlyDataContextEnhancerTest.java
…er mock The feature branch added an inlinePrefix parameter to EndTransactionMalwareScanProvider.getChangeSetListener. A test added on main was still using the 2-arg overload.
What
Adds support for inline (single) attachments using the
Attachmenttype directly on an entity field (e.g.profilePicture: Attachment), in addition to the existing composition-basedComposition of many Attachmentspattern.Key Changes
@_is_media_dataannotation at element levelcoverImage_contentId→contentId)How it works
When an entity has
field: Attachment, CDS flattens the Attachment fields into the parent table with a prefix (e.g.coverImage_content,coverImage_contentId). The handlers detect this via the@_is_media_dataannotation at element level, extract the prefixed data into normalizedAttachmentsmaps, and inject parent entity keys for downstream matching.