This is an automated email from the ASF dual-hosted git repository.

olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new dad8c6d69 Disable Limited Validation when Validation mode is Full
dad8c6d69 is described below

commit dad8c6d691e92ea62cd2f8e3ef1e7898b65f8a23
Author: olabusayoT <[email protected]>
AuthorDate: Wed Oct 2 16:37:04 2024 -0400

    Disable Limited Validation when Validation mode is Full
    
    - update comments and tests
    
    Deprecation/Compatibility:
    Full Validation no longer performs limited validation in addition to Xerces 
validation. It now only performs Xerces validation.
    
    DAFFODIL-2896
---
 .../org/apache/daffodil/example/TestJavaAPI.java   |  7 +-
 .../dpath/DFDLCheckConstraintsFunction.scala       |  2 +-
 .../processors/parsers/ElementCombinator1.scala    |  4 +-
 .../processors/parsers/SequenceChildBases.scala    |  4 +-
 .../org/apache/daffodil/example/TestScalaAPI.scala |  6 +-
 .../tdml/TestTDMLRunnerValidationErrors.scala      | 13 +++-
 .../section02/validation_errors/Validation.tdml    | 77 ++++++++++------------
 .../daffodil/section05/facets/PatternRanges.tdml   |  3 +-
 .../discriminators/nestedChoiceDiscriminator.tdml  |  6 --
 .../text_number_props/TextNumberProps.tdml         |  8 ++-
 .../apache/daffodil/infoset/TestStringAsXml.scala  | 16 +----
 11 files changed, 64 insertions(+), 82 deletions(-)

diff --git 
a/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java 
b/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
index 4414e0d59..6462367b8 100644
--- a/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
+++ b/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
@@ -788,10 +788,9 @@ public class TestJavaAPI {
             assertEquals(file.length(), actualLength);
 
             java.util.List<Diagnostic> diags = res.getDiagnostics();
-            assertEquals(3, diags.size());
+            assertEquals(2, diags.size());
             Diagnostic d0 = diags.get(0);
             Diagnostic d1 = diags.get(1);
-            Diagnostic d2 = diags.get(2);
 
             assertTrue(d0.getMessage().contains("42"));
             assertTrue(d0.getMessage().contains("e2"));
@@ -800,10 +799,6 @@ public class TestJavaAPI {
             assertTrue(d1.getMessage().contains("42"));
             assertTrue(d1.getMessage().contains("maxInclusive"));
             assertTrue(d1.getMessage().contains("20"));
-
-            assertTrue(d2.getMessage().contains("maxInclusive"));
-            assertTrue(d2.getMessage().contains("e2"));
-            assertTrue(d2.getMessage().contains("20"));
         }
     }
 
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DFDLCheckConstraintsFunction.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DFDLCheckConstraintsFunction.scala
index 701393818..61752e739 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DFDLCheckConstraintsFunction.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DFDLCheckConstraintsFunction.scala
@@ -25,7 +25,7 @@ import org.apache.daffodil.runtime1.processors.parsers.PState
 object DFDLCheckConstraintsFunction {
 
   /**
-   * Used for validation purposes when ValidationMode is Limited or Full.
+   * Used for validation purposes when ValidationMode is Limited.
    *
    * Provides the result Unit on Success or a message (String) on Failure.
    *
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementCombinator1.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementCombinator1.scala
index cf217caaf..2266961c7 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementCombinator1.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementCombinator1.scala
@@ -198,8 +198,10 @@ abstract class ElementParserBase(
 
       if (pstate.processorStatus ne Success) return
 
+      // if we should do limited validation via CheckConstraints
       val shouldValidate = erd.isSimpleType &&
-        pstate.dataProc.isDefined && pstate.dataProc.value.validationMode != 
ValidationMode.Off
+        pstate.dataProc.isDefined &&
+        pstate.dataProc.value.validationMode == ValidationMode.Limited
 
       if (shouldValidate) {
         validate(pstate)
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceChildBases.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceChildBases.scala
index e32b0a0bf..ac5d601a3 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceChildBases.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceChildBases.scala
@@ -529,8 +529,10 @@ trait EndArrayChecksMixin {
   def endArray(state: ParseOrUnparseState, occurrences: Long): Unit = {
     if (state.processorStatus eq Success) {
 
+      // if we should do limited validation
       val shouldValidate =
-        state.dataProc.isDefined && state.dataProc.value.validationMode != 
ValidationMode.Off
+        state.dataProc.isDefined &&
+          state.dataProc.value.validationMode == ValidationMode.Limited
 
       if (shouldValidate) {
         val minO = erd.minOccurs
diff --git 
a/daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala 
b/daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
index 371dd9edc..4dcee6dd2 100644
--- 
a/daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
+++ 
b/daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
@@ -810,10 +810,9 @@ class TestScalaAPI {
       assertEquals(file.length, actualLength)
 
       val diags = res.getDiagnostics
-      assertEquals(3, diags.size)
+      assertEquals(2, diags.size)
       val d0 = diags(0)
       val d1 = diags(1)
-      val d2 = diags(2)
       assertTrue(d0.getMessage().contains("42"))
       assertTrue(d0.getMessage().contains("e2"))
       assertTrue(d0.getMessage().contains("not valid"))
@@ -822,9 +821,6 @@ class TestScalaAPI {
       assertTrue(d1.getMessage().contains("maxInclusive"))
       assertTrue(d1.getMessage().contains("20"))
 
-      assertTrue(d2.getMessage().contains("maxInclusive"))
-      assertTrue(d2.getMessage().contains("e2"))
-      assertTrue(d2.getMessage().contains("20"))
     }
   }
   @Test
diff --git 
a/daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml/TestTDMLRunnerValidationErrors.scala
 
b/daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml/TestTDMLRunnerValidationErrors.scala
index f3ed113d5..9171c1ad0 100644
--- 
a/daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml/TestTDMLRunnerValidationErrors.scala
+++ 
b/daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml/TestTDMLRunnerValidationErrors.scala
@@ -66,7 +66,11 @@ class TestTDMLRunnerValidationErrors {
 
         <ts:validationErrors>
           <ts:error>Validation Error</ts:error>
-          <ts:error>r failed</ts:error>
+          <ts:error>r</ts:error>
+          <ts:error>not valid</ts:error>
+          <ts:error>foo</ts:error>
+          <ts:error>not facet-valid</ts:error>
+          <ts:error>[YES]</ts:error>
         </ts:validationErrors>
       </ts:parserTestCase>
 
@@ -80,8 +84,11 @@ class TestTDMLRunnerValidationErrors {
 
         <ts:validationErrors>
           <ts:error>Validation Error</ts:error>
-          <ts:error>r failed</ts:error>
-        </ts:validationErrors>
+          <ts:error>r</ts:error>
+          <ts:error>not valid</ts:error>
+          <ts:error>foo</ts:error>
+          <ts:error>not facet-valid</ts:error>
+          <ts:error>[YES]</ts:error>        </ts:validationErrors>
       </ts:parserTestCase>
 
       <ts:parserTestCase name="expectsNoValidationErrorGetsNoValidationError" 
root="r" model="schema1" roundTrip="onePass">
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section02/validation_errors/Validation.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section02/validation_errors/Validation.tdml
index 243e6ef44..88bb88702 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section02/validation_errors/Validation.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section02/validation_errors/Validation.tdml
@@ -882,9 +882,11 @@
     <tdml:validationErrors>
 
       <tdml:error>e4_6_2</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet enumeration(s)</tdml:error>
-      <tdml:error>SATURDAY|SUNDAY</tdml:error>
+      <tdml:error>not valid</tdml:error>
+
+      <tdml:error>MONDAY</tdml:error>
+      <tdml:error>not facet-valid</tdml:error>
+      <tdml:error>SATURDAY, SUNDAY</tdml:error>
 
                </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -981,8 +983,10 @@
     <tdml:validationErrors>
 
       <tdml:error>e4_4_1</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet minExclusive (-5)</tdml:error>
+      <tdml:error>not valid</tdml:error>
+
+      <tdml:error>-5</tdml:error>
+      <tdml:error>not facet-valid</tdml:error>
 
     </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -1149,8 +1153,8 @@
     <tdml:validationErrors>
 
       <tdml:error>e4_1</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet totalDigits (5)</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>total digits has been limited to 5</tdml:error>
 
                </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -1255,8 +1259,7 @@
     <tdml:validationErrors>
 
       <tdml:error>intRestrict</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxInclusive (10)</tdml:error>
+      <tdml:error>not valid</tdml:error>
 
       <tdml:error>intRestrict</tdml:error>
       <tdml:error>Value '12' has 2 total digits</tdml:error>
@@ -1364,7 +1367,7 @@
       Purpose: This test demonstrates the use of validation for a combination 
of the
                minOccurs, totalDigits, and maxExclusive facets.
                This test will fail because validation is on.
-               Validation = LIMITED.
+               Validation = ON.
 --> 
   <tdml:parserTestCase name="facetCombos_fail_on_02"
     root="arrayCombo" model="facetCombos" validation="on">
@@ -1385,40 +1388,30 @@
                </tdml:infoset>
     <tdml:validationErrors>
 
+      <tdml:error>5</tdml:error>
       <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
+      <tdml:error>not valid</tdml:error>
       <tdml:error>byte 14</tdml:error>
 
-      <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 11</tdml:error>
-
-      <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 9</tdml:error>
-
-      <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 7</tdml:error>
+      <tdml:error>7</tdml:error>
+      <tdml:error>not facet-valid</tdml:error>
+      <tdml:error>maxExclusive '3'</tdml:error>
+      <tdml:error>byte 14</tdml:error>
 
+      <tdml:error>6</tdml:error>
       <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 5</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>byte 14</tdml:error>
 
+      <tdml:error>8</tdml:error>
       <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 3</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>byte 14</tdml:error>
 
+      <tdml:error>10</tdml:error>
       <tdml:error>e</tdml:error>
-      <tdml:error>failed facet checks</tdml:error>
-      <tdml:error>facet maxExclusive (3)</tdml:error>
-      <tdml:error>byte 1</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>byte 14</tdml:error>
 
                </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -1784,8 +1777,8 @@
       <tdml:error>number of total digits has been limited to 1.</tdml:error>
 
       <tdml:error>Validation Error</tdml:error>
-      <tdml:error>trigger failed facet checks</tdml:error>
-      <tdml:error>facet totalDigits (1)</tdml:error>
+      <tdml:error>trigger</tdml:error>
+      <tdml:error>not valid</tdml:error>
 
                </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -1812,7 +1805,7 @@
 
       <tdml:error>Value '42' is not facet-valid with respect to minExclusive 
'42'</tdml:error>
       
-      <tdml:error>one failed facet checks due to: facet minExclusive 
(42)</tdml:error>
+      <tdml:error>'42' of element 'ex:one' is not valid</tdml:error>
 
                </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -1844,7 +1837,7 @@
     </tdml:infoset>
 
     <tdml:validationErrors>
-      <tdml:error>nonNegA failed facet checks due to: facet minInclusive 
(30)</tdml:error>
+      <tdml:error>'20' is not facet-valid with respect to minInclusive 
'30'</tdml:error>
     </tdml:validationErrors>
 
   </tdml:parserTestCase>
@@ -2140,7 +2133,7 @@
 
         <tdml:validationErrors>
             <tdml:error>Validation Error</tdml:error>
-            <tdml:error>failed facet checks due to: facet minLength 
(7)</tdml:error>
+            <tdml:error>not facet-valid with respect to minLength 
'7'</tdml:error>
         </tdml:validationErrors>
 
     </tdml:parserTestCase>
@@ -2160,7 +2153,7 @@
 
         <tdml:validationErrors>
             <tdml:error>Validation Error</tdml:error>
-            <tdml:error>failed facet checks due to: facet length 
(7)</tdml:error>
+            <tdml:error>not facet-valid with respect to length '7'</tdml:error>
         </tdml:validationErrors>
 
     </tdml:parserTestCase>
@@ -2177,7 +2170,7 @@
         </tdml:infoset>
         <tdml:validationErrors>
             <tdml:error>Validation Error</tdml:error>
-            <tdml:error>failed facet checks due to: facet maxLength 
(5)</tdml:error>
+            <tdml:error>not facet-valid with respect to maxLength 
'5'</tdml:error>
         </tdml:validationErrors>
     </tdml:parserTestCase>
 
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/PatternRanges.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/PatternRanges.tdml
index 0c142508a..e9d23e0b8 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/PatternRanges.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/PatternRanges.tdml
@@ -115,7 +115,8 @@
       </tdml:dfdlInfoset>
     </tdml:infoset>
     <tdml:validationErrors>
-      <tdml:error>ex:str failed facet checks</tdml:error>
+      <tdml:error>ex:str</tdml:error>
+      <tdml:error>not valid</tdml:error>
     </tdml:validationErrors>
   </tdml:parserTestCase>
 </tdml:testSuite>
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/discriminators/nestedChoiceDiscriminator.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/discriminators/nestedChoiceDiscriminator.tdml
index 32732de5b..a406749e9 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/discriminators/nestedChoiceDiscriminator.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/discriminators/nestedChoiceDiscriminator.tdml
@@ -251,9 +251,6 @@ backtrack and get an unrecognizedMessage because the outer 
choice was discrimina
       <tdml:error>Invalid content</tdml:error>
       <tdml:error>unrecognizedMessage</tdml:error>
       <tdml:error>message1, message2</tdml:error>
-      <tdml:error>occurred '1' times</tdml:error>
-      <tdml:error>minimum of '0'</tdml:error>
-      <tdml:error>maximum of '0'</tdml:error>
     </tdml:validationErrors>
   </tdml:parserTestCase>
 
@@ -297,9 +294,6 @@ backtrack and get an unrecognizedMessage because the outer 
choice was discrimina
       <tdml:error>Invalid content</tdml:error>
       <tdml:error>messageParseError</tdml:error>
       <tdml:error>message1, message2</tdml:error>
-      <tdml:error>occurred '1' times</tdml:error>
-      <tdml:error>minimum of '0'</tdml:error>
-      <tdml:error>maximum of '0'</tdml:error>
     </tdml:validationErrors>
   </tdml:parserTestCase>
 
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section13/text_number_props/TextNumberProps.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section13/text_number_props/TextNumberProps.tdml
index 8093dcfa8..8c55ef2fc 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section13/text_number_props/TextNumberProps.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section13/text_number_props/TextNumberProps.tdml
@@ -3021,7 +3021,9 @@
     <tdml:validationErrors>
 
       <tdml:error>Validation Error</tdml:error>
-      <tdml:error>tnp76 failed facet checks due to: facet totalDigits 
(6)</tdml:error>
+      <tdml:error>tnp76</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>number of total digits has been limited to 6</tdml:error>
 
     </tdml:validationErrors>
   </tdml:parserTestCase>
@@ -3050,7 +3052,9 @@
     <tdml:validationErrors>
 
       <tdml:error>Validation Error</tdml:error>
-      <tdml:error>tnp77 failed facet checks due to: facet fractionDigits 
(3)</tdml:error>
+      <tdml:error>tnp77</tdml:error>
+      <tdml:error>not valid</tdml:error>
+      <tdml:error>number of fraction digits has been limited to 3</tdml:error>
 
     </tdml:validationErrors>
   </tdml:parserTestCase>
diff --git 
a/daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXml.scala
 
b/daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXml.scala
index 18ba0c9cc..d48462081 100644
--- 
a/daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXml.scala
+++ 
b/daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXml.scala
@@ -95,13 +95,7 @@ class TestStringAsXml {
       IOUtils.toString(is, StandardCharsets.UTF_8)
     }
     // diagnostic from full validation
-    assertTrue(parseDiags.find(_.contains("Element 'xmlStr' is a simple 
type")).isDefined)
-    // diagnostic from limited validation
-    assertTrue(
-      parseDiags
-        .find(_.contains("xmlStr failed facet checks due to: facet maxLength"))
-        .isDefined
-    )
+    assertTrue(parseDiags.exists(_.contains("Element 'xmlStr' is a simple 
type")))
     // we still get the expected infoset, replace CRLF with LF because of git 
windows autocrlf
     assertEquals(
       parseInfosetExpected.replace("\r\n", "\n"),
@@ -304,13 +298,7 @@ class TestStringAsXml {
       IOUtils.toString(is, StandardCharsets.UTF_8)
     }
     // diagnostic from full validation
-    assertTrue(parseDiags.find(_.contains("Element 'xmlStr' is a simple 
type")).isDefined)
-    // diagnostic from limited validation
-    assertTrue(
-      parseDiags
-        .find(_.contains("xmlStr failed facet checks due to: facet maxLength"))
-        .isDefined
-    )
+    assertTrue(parseDiags.exists(_.contains("Element 'xmlStr' is a simple 
type")))
     // we still get the expected infoset, replace CRLF with LF because of git 
windows autocrlf
     assertEquals(
       parseInfosetExpected.replace("\r\n", "\n"),

Reply via email to