Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-8012

!override directive doesn't work at array root level

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 6.2.6
    • None

    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"

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              miruela Mercedes Iruela
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD