Repository: bval
Updated Branches:
  refs/heads/bv2 f5bdeaf10 -> 9019464db


fix XML mappings descriptor and XML group conversion parsing


Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/9019464d
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/9019464d
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/9019464d

Branch: refs/heads/bv2
Commit: 9019464db406dc00315c7b4ab0506f07110f2385
Parents: f5bdeaf
Author: Matt Benson <mben...@apache.org>
Authored: Thu Apr 12 14:59:11 2018 -0500
Committer: Matt Benson <mben...@apache.org>
Committed: Thu Apr 12 14:59:11 2018 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java   | 4 +++-
 bval-jsr/src/main/xsd/validation-mapping-2.0.xsd                 | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/9019464d/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
index b68457a..5713402 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
@@ -45,6 +45,7 @@ import javax.validation.ConstraintDeclarationException;
 import javax.validation.ConstraintTarget;
 import javax.validation.Payload;
 import javax.validation.ValidationException;
+import javax.validation.groups.Default;
 import javax.xml.bind.JAXBElement;
 
 import org.apache.bval.jsr.ConstraintAnnotationAttributes;
@@ -294,7 +295,8 @@ public class XmlBuilder {
 
             this.getGroupConversions = new Lazy<>(() -> {
                 return getGroupConversions.apply(descriptor).stream().map(gc 
-> {
-                    final Class<?> source = resolveClass(gc.getFrom());
+                    final String from = gc.getFrom();
+                    final Class<?> source = from == null ? Default.class : 
resolveClass(from);
                     final Class<?> target = resolveClass(gc.getTo());
                     return GroupConversion.from(source).to(target);
                 }).collect(ToUnmodifiable.set());

http://git-wip-us.apache.org/repos/asf/bval/blob/9019464d/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd 
b/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd
index 418b68b..f65cdc8 100644
--- a/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd
+++ b/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd
@@ -41,7 +41,7 @@
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="groupConversionType">
-    <xs:attribute type="xs:string" name="from" use="required" />
+    <xs:attribute type="xs:string" name="from" use="optional" />
     <xs:attribute type="xs:string" name="to" use="required" />
   </xs:complexType>
   <xs:complexType name="constraint-mappingsType">

Reply via email to