[MAGNOLIA-8012] !override directive doesn't work at array root level Created: 03/Mar/21  Updated: 18/Dec/23

Status: Accepted
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.6
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Mercedes Iruela Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: light-development
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: Support
Story Points: 5
Team: DeveloperX

 Description   

Steps to reproduce

  1.  Create the following decoration to the dam-app (<LIGHT_MODULE>/decorations/dam-assets-app/apps/dam-app-core/dam.subapps.jcrdetail.yaml)
    form: !override
      properties:
        test:
          $type: textField
    

Expected results

All properties/nodes bellow form are ignored and only the new field test is added to the definition

Actual results

Properties/nodes bellow form are not ignored but merged, so original fields + new field are displayed.

Workaround

Use this decoration instead: (<LIGHT_MODULE>/decorations/dam-assets-app/apps/dam-app-core/dam.subapps.jcrdetail.form.yaml)

  properties: !override
    test:
      $type: textField

Or change the format of the decorated definition from array of properties to map of properties.

Development notes

The !override directive behaviour is not homogeneous and difficult to understand why.

The is a note in the documentation:

Due to the syntax of a YAML list, you cannot apply !override to a list item. To bypass this constraint, use a YAML map instead of a list to apply !override to an item. Even if the definition class expects a list, the YAML file can define the item with a map.

Roman's suspicion is "Seems to be a different constraint (meaning you cannot override a field written as an array item) but nothing about overriding whole array"


Generated at Mon Feb 12 04:28:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.