<div dir="ltr">Hi all,<div><br></div><div>I&#39;ve started to work on a new version of the XSD for constraint mapping files in order to allow for the XML-based configuration of method/constructor constraints [1] and group conversions [2]. The latest XSD draft can be found at [3].</div>

<div><br></div><div>The following shows how the configuration of method constraints and group conversions would look like:</div><br>    &lt;bean class=&quot;com.acme.MyBean&quot; ignore-annotations=&quot;false&quot;&gt;<br>
        &lt;method name=&quot;getFirstname&quot; ignore-annotations=&quot;true&quot;&gt;<br>
            &lt;parameter type=&quot;java.lang.String&quot;&gt;<br>                &lt;constraint annotation=&quot;javax.validation.constraints.Pattern&quot;&gt; <br>                    &lt;message&gt;Last name has to start with with a capital letter.&lt;/message&gt;<div>

                    &lt;element name=&quot;regexp&quot;&gt;^[A-Z][a-z]+&lt;/element&gt;</div><div>                &lt;/constraint&gt;<br>            &lt;/parameter&gt;</div><div>            &lt;parameter type=&quot;int&quot;&gt;</div>

<div>                &lt;valid/&gt;</div><div>                &lt;constraint annotation=&quot;javax.validation.constraints.Min&quot;&gt;<br>                    &lt;element name=&quot;value&quot;&gt;1&lt;/element&gt;</div>

<div>                &lt;/constraint&gt;</div><div>                &lt;convertGroup from=&quot;javax.validation.groups.Default&quot; to=&quot;com.acme.Basic&quot;/&gt;<br>            &lt;/parameter&gt;</div><div><span class="">            &lt;</span><span class="">parameter</span><span class=""> </span>type<span class="">=</span><span class="">&quot;long&quot;</span><span class=""> </span>ignore-annotations<span class="">=</span><span class="">&quot;false&quot;</span><span class="">/&gt;</span></div>

<div>            &lt;returnValue&gt;<br>                &lt;valid/&gt;</div><div>                &lt;constraint annotation=&quot;javax.validation.constraints.Pattern&quot;&gt;</div><div>                    &lt;message&gt;Last name has to start with with a capital letter.&lt;/message&gt;</div>

<div>                    &lt;element name=&quot;regexp&quot;&gt;^[A-Z][a-z]+&lt;/element&gt;</div><div>                &lt;/constraint&gt;<br>            &lt;/returnValue&gt;</div><div>            &lt;crossParameterConstraint annotation=&quot;com.acme.MyCrossParameterConstraint&quot;/&gt;</div>

<div>        &lt;/method&gt;</div><div>    &lt;/bean&gt;</div><div><br></div><div>I tried to follow the existing style and patterns. Some notes:</div><div><br></div><div>* Always all the parameters of an executable must be specified in order to identify overloaded executables, also if the configuration of a particular parameter shall remain unchanged (ignore-annotations<span class="">=</span><span class="">&quot;false&quot; is to be used in this case).</span></div>
<div style><span class="">* ignore-annotations on methods/constructors overrides ignore-annotations on the bean level; </span>ignore-annotations on parameters/return values overrides ignore-annotations on the method/constructor and bean levels</div>
<div style><span class="">* parameters are identified by their type. The FQN of the type is to be used (taking &quot;default-package&quot; into account), or &quot;int&quot;, &quot;long&quot; etc. for primitive types.</span></div>
<div style><span class="">* A getter method must either be configured using the &quot;getter&quot; or the &quot;method&quot; element. If both are given for one and the same getter, a ValidationException will be thrown.</span></div>
<div style><span class=""><br></span></div><div style><span class="">Is there anything else we should add or consider? If there are no objections, I&#39;ll move forward with adapting the spec next week.</span></div><div style>
<span class=""><br></span></div><div style>Thanks,</div><div style><br></div><div style>--Gunnar</div>
<div><br><div>[1] <a href="https://hibernate.onjira.com/browse/BVAL-273" target="_blank">https://hibernate.onjira.com/browse/BVAL-273</a></div><div>[2] <a href="https://hibernate.onjira.com/browse/BVAL-333" target="_blank">https://hibernate.onjira.com/browse/BVAL-333</a></div>
<div>[3] <a href="https://github.com/gunnarmorling/hibernate-validator/compare/HV-373">https://github.com/gunnarmorling/hibernate-validator/compare/HV-373</a></div><div><br></div>
</div></div>