Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-12756

Enforce HCM syntax rule that subnodes in definitions cannot include multiple path segments

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • repository
    • None
    • Pulsar
    • !Pulsar - Misc brXM

    Description

      Auto-export creates duplicate nodes in exported YAML config when a certain format is used that works fine when importing YAML config.

      Steps to reproduce:

      1: Create a 13.3.0 archetype project:

      mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=https://maven.onehippo.com/maven2 -DarchetypeGroupId=org.onehippo.cms7 -DarchetypeArtifactId=hippo-project-archetype -DarchetypeVersion=13.3.0-SNAPSHOT 

      2: Add a file repository-data/application/src/main/resources/hcm-config/configuration/modules/validation.yaml with the following content:

      definitions:
        config:
          /hippo:configuration/hippo:modules/validation/hippo:moduleconfig:
            /test:
              jcr:primaryType: hipposys:moduleconfig
              hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator
            /required/test2:  # <------------------------------------------------------------------  This syntax is invalid!
              jcr:primaryType: hipposys:moduleconfig
              hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator 

      3: Build the project and run it:

      cd myproject
      mvn clean verify
      mvn -Pcargo.run -Drepo.path=storage 

      4: In the console, go to /hippo:configuration/hippo:modules/validation/hippo:moduleconfig. Notice how the system bootstrapped the 'test' and 'test2' nodes without problems or warnings.

      5: Copy the node 

      /hippo:configuration/hippo:modules/validation/hippo:moduleconfig/test 

      to

      /hippo:configuration/hippo:modules/validation/hippo:moduleconfig/test3 

       (which mimics a developer that adds a custom validator to the system)

      6: Notice how auto-export exports the new node to the validation.yaml file. However, validation.yaml now contains:

      definitions:
        config:
          /hippo:configuration/hippo:modules/validation/hippo:moduleconfig:
            /test:
              jcr:primaryType: hipposys:moduleconfig
              hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator
            /required/test2:
              jcr:primaryType: hipposys:moduleconfig
              hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator
            /test3:
              jcr:primaryType: hipposys:moduleconfig
              hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator
          /hippo:configuration/hippo:modules/validation/hippo:moduleconfig/required/test2:
            jcr:primaryType: hipposys:moduleconfig
            hipposys:className: org.onehippo.cms.services.validation.validator.NonEmptyValidator

      Expected: the node 'test2' appears only once in validation.yaml

      Actual: the node 'test2' appears twice in validation.yaml

      The system should either refuse to import the initial validation.yaml file in step 3, or not export the already present 'test2' node.

      Attachments

        Issue Links

          Activity

            People

              PCentgraf Peter Centgraf
              mdenburger Mathijs den Burger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: