open-ux-tools icon indicating copy to clipboard operation
open-ux-tools copied to clipboard

FEATURE - Automatically enable the notes reuse component if a service is annotated with UI.Note

Open tobiasqueck opened this issue 1 month ago • 3 comments

As a developer, I want to generate a Fiori elements for OData v4 application for a service with the UI.Notes annotation that is working out of the box, so that I can work with it without having to manually add the reuse component

Description

In 2023 the new UI.Note annotation (https://github.com/SAP/odata-vocabularies/pull/221/files) was introduced. In addition, in the latest SAP systems, there is a reuse component sap.nw.core.gbt.notes.lib.reuse designed to be used if the annotation UI.Note is part of the service metadata. For a Fiori elements app to be able to make user of the reuse lib, it needs to be added as a dependency to the manifest. Since, we know the metadata (and annotation) at generation time, it would be great if the reuse lib is added automatically if the annotation is present.

Example (mocked) metadata for testing: metadata.xml.zip.

Technical Design

It is only relevant for the fiori-elements-writer module specifically for apps with an OData v4 service. So, in the module, if version is 4 then we should check if the provided metadata contains the UI.Note annotation. If yes, then we add nw.core.gbt.notes.lib.reuse as a dependency to the manifest.json

I would recommend to keep it simple, and do a check of the metadata (string) for @UI.Note. if included, at the lib, if not then don't. You can (but again, I wouldn't suggest it), do a more precise check and see if the annotations contain a UI.ReferenceFacet with a target pointing to the annotation.

Acceptance Criteria

GivenWhenThen format (https://martinfowler.com/bliki/GivenWhenThen.html)

Given I have a v4 service with the UI.Note annotation... when I generate a Fiori elements (including FPM) app then the generated manifest will contain the required dependency.

Given I have a v4 service WITHOUT the UI.Note annotation... when I generate a Fiori elements (including FPM) app then the generated manifest will NOT contain the dependency.

Notes

Tasks

  • [ ] Functionality implemented
  • [ ] Unit Tests added
  • [ ] Test Cases defined

tobiasqueck avatar May 13 '24 14:05 tobiasqueck