AnsweredAssumed Answered

Incorrect schema validation on <constraints>?

Question asked by bengrah on Oct 20, 2010
Latest reply on Oct 21, 2010 by janv
Hi all

I've been doing some custom data modelling using constraints, using Notepad++'s XML plugins to validate markup on it's own and against the modelSchema.xsd file found in WEB-INF/classes/alfresco/model and noticed some behaviour I'm not sure is correct.

I have the following in my custom data model:

   <constraints>
  
        <constraint name="mg:correspondenceTypeConstraint">
            <parameter name="allowedValues">
                <list>
                    <value>One</value>
                    <value>Two</value>
                    <value>Three</value>
                </list>
            </parameter>
        </constraint>
       
   </constraints>

Validating this markup against the schema results in an all clear. I started up Alfresco, no issues what so ever. I have the proper constraint reference markup in the file also (not shown) so that's working as well. After retarting Alfresco I noticed that the List constraint I want on a property doesn't exist. The solution is include type="LIST" in the <constraint> tag. That's fine, but shouldn't the schema have picked up on the fact I missed decalring a type? Since out of all four constraints Alfresco uses you're always meant to define a type.

It's possible that like some options in data modelling, not declaring elements usually means they're set up with default settings that are invisible to the user, but I would've thought that something like constraint type would be something mandatory.

At first I thought it's possible that the Notepad++ plugin I was using was a bit faulty, so I tried this validator (http://tools.decisionsoft.com/schemaValidate) but again got a validated xml document.

Outcomes