Conversation
There was a problem hiding this comment.
The PR consistently renames fileName→filename, scannedAt→lastScan, and moves StatusCode to a dedicated service-layer class — a clean, well-coordinated refactoring across all layers and all 35 i18n files. Three issues were found: the README table still references the old attachment_fileName i18n key (stale after the rename), and contentId and lastScan lost their @readonly constraints at the CDS model level, making them writable when the model is consumed without the annotations file.
PR Bot Information
Version: 1.17.99 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Correlation ID:
2a5abde0-1bb0-11f1-8667-7da2eb9ca755 - Event Trigger:
pull_request.opened - LLM:
anthropic--claude-4.6-sonnet
| | `content` | `attachment_content` | | ||
| | `mimeType` | `attachment_mimeType` | | ||
| | `fileName` | `attachment_fileName` | | ||
| | `filename` | `attachment_fileName` | |
There was a problem hiding this comment.
Bug: i18n code in README table is stale after the rename
The table claims the i18n code for filename is attachment_fileName, but all i18n property files were updated to use attachment_filename. This mismatch will mislead consumers who look up the key to override the translation.
| | `filename` | `attachment_fileName` | | |
| | `filename` | `attachment_filename` | | |
Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box:
- 🌟 Awesome comment, a human might have missed that.
- ✅ Helpful comment
- 🤷 Neutral
- ❌ This comment is not helpful
| status : String default 'Unscanned'; | ||
| statusNav : Association to one ScanStates | ||
| on statusNav.code = status; | ||
| lastScan : Timestamp; |
There was a problem hiding this comment.
Logic Error: contentId, status, and lastScan lost their @readonly annotations
In the previous model, contentId, status, and scannedAt were all annotated @readonly. The new model removes @readonly from contentId and status (and drops it entirely for lastScan). The annotations file only re-adds @readonly to status and contentId via the annotations file, but leaves lastScan without any read-only protection at the entity level. If the annotations file is consumed independently, or a service exposes these fields without the annotations, lastScan and contentId become writable — which contradicts the documented design that these fields must not be updated by clients (see doc/Design.md and doc/Processes.md).
| lastScan : Timestamp; | |
| lastScan : Timestamp @readonly; | |
Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box:
- 🌟 Awesome comment, a human might have missed that.
- ✅ Helpful comment
- 🤷 Neutral
- ❌ This comment is not helpful
| mimeType : String default 'application/octet-stream'; | ||
| filename : String; | ||
| hash : String; | ||
| contentId : String; // id of attachment in external storage, if database storage is used, same as id |
There was a problem hiding this comment.
Logic Error: contentId lost its @readonly annotation at the model level
Previously contentId was @readonly in the aspect definition. The new model removes this, leaving it only in the annotations file. This is inconsistent with how status is handled and means contentId is writable if the base model is used without annotations (e.g. in programmatic access or non-UI scenarios).
| contentId : String; // id of attachment in external storage, if database storage is used, same as id | |
| contentId : String @readonly; // id of attachment in external storage, if database storage is used, same as id | |
Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box:
- 🌟 Awesome comment, a human might have missed that.
- ✅ Helpful comment
- 🤷 Neutral
- ❌ This comment is not helpful
Align CDS Schema with Node: Rename Fields and Restructure Attachment Model
♻️ Refactor: Aligns the Java CDS attachment feature schema with the Node.js CDS implementation by renaming fields, restructuring the data model, and moving
StatusCodeto a dedicated service model class.Changes
This PR introduces several breaking schema changes to match the Node.js CDS model:
fileName→filename: Renamed across all layers — CDS model, Java handlers, service model, i18n files (35 languages), annotations, tests, integration tests, and sample code.scannedAt→lastScan: Renamed in the CDS model, handlers, malware scanner, annotations, readonly field logic, and all related tests.StatusCodetype refactored: TheStatusCodetype was previously a CDS-generated enum insap.attachments. It is now a standalone Java class (com.sap.cds.feature.attachments.service.model.StatusCode) with string constants. All imports updated across the codebase.ScanStatesentity added: The CDS model now defines aScanStatesentity extendingCodeListwith acriticalityfield, replacing the old inlineStatusCodeenum type.statusfield changed: From a typedStatusCodefield (readonly) to a plainStringwith a default of'Unscanned'and a newstatusNavassociation toScanStates.notefield: Changed fromString(5000)to unboundedString.urlandhashfields added toMediaDataaspect.attachments-annotations.cds:filenameannotation corrected,contentmarked@odata.draft.skip, fields likeurl,hash,lastScanmarked hidden/computed,LineItementries reformatted withCriticality, andSortRestrictionsadded.CreateAttachmentInputrecord:fileNameparameter renamed tofilename.attachment_fileName→attachment_filenamein all 35 language files.Key Files
attachments.cds: ReplacedStatusCodeenum type withScanStatesentity, renamed fields, addedurl,hash,statusNav, changednoteto unbounded string.attachments-annotations.cds: Updated field references, annotations, andLineItemstructure.StatusCode.java(new): Standalone class with scan status string constants.CreateAttachmentInput.java,AttachmentsServiceImpl.java,CreateAttachmentEvent.java:fileName→filenamerename.DefaultAttachmentMalwareScanner.java,MarkAsDeletedAttachmentEvent.java,ReadonlyDataContextEnhancer.java:scannedAt→lastScanrename.README.md,doc/Design.md,doc/Processes.md: Documentation updated to reflect field renames.i18n_*.propertiesfiles:attachment_fileNamekey renamed toattachment_filename.StatusCodeimport path.OSSAttachmentsServiceHandler.java,FSAttachmentsServiceHandler.java,FSDraftServiceHandler.java: Updated to usefilenameand newStatusCodeimport.samples/bookshop/srv/.../RestHandler.java: Updated API responses to usefilename.📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!
PR Bot Information
Version:
1.17.99| 📖 Documentation | 🚨 Create Incident | 💬 Feedbackpull_request.openedanthropic--claude-4.6-sonnet2a5abde0-1bb0-11f1-8667-7da2eb9ca755