diff --git a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd index 3d89c56617..fffa275bb6 100644 --- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd +++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd @@ -185,6 +185,13 @@ + + + + This tunable allows the escalation of Schema Definition Warnings to Errors. + + + diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/SDE.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/SDE.scala index 0108e5f8af..e160286416 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/SDE.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/SDE.scala @@ -262,14 +262,26 @@ trait ImplementsThrowsOrSavesSDE extends ImplementsThrowsSDE with SavesErrorsAnd val suppress = lssdw.contains(warnID) || lssdw.contains(WarnID.All) || tssdw.contains(warnID) || tssdw.contains(WarnID.All) if (!suppress) { - val sdw = new SchemaDefinitionWarning( - warnID, - Some(schemaFileLocation), - NoAnnotationContext, - fmt, - args: _* - ) - warn(sdw) + if (tunable.escalateWarningsToErrors) { + val msg = "warnings escalated to errors: " + fmt + val sde = new SchemaDefinitionError( + Some(schemaFileLocation), + NoAnnotationContext, + msg, + args: _* + ) + error(sde) + } else { + + val sdw = new SchemaDefinitionWarning( + warnID, + Some(schemaFileLocation), + NoAnnotationContext, + fmt, + args: _* + ) + warn(sdw) + } } } diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section02/schema_definition_errors/SchemaDefinitionErrors.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section02/schema_definition_errors/SchemaDefinitionErrors.tdml index f8c0fedb1e..14b0fd011e 100644 --- a/daffodil-test/src/test/resources/org/apache/daffodil/section02/schema_definition_errors/SchemaDefinitionErrors.tdml +++ b/daffodil-test/src/test/resources/org/apache/daffodil/section02/schema_definition_errors/SchemaDefinitionErrors.tdml @@ -308,4 +308,41 @@ + + + + + + + + + + + + + + + true + + + + + + + + + Schema Definition Error + warnings escalated to errors + xs:appinfo source attribute + + + diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section02/schema_definition_errors/TestSDE.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section02/schema_definition_errors/TestSDE.scala index e215b43a2b..03258887a7 100644 --- a/daffodil-test/src/test/scala/org/apache/daffodil/section02/schema_definition_errors/TestSDE.scala +++ b/daffodil-test/src/test/scala/org/apache/daffodil/section02/schema_definition_errors/TestSDE.scala @@ -57,4 +57,8 @@ class TestSDE { @Test def test_schema_warning_locally_suppressed(): Unit = { runner.runOneTest("schema_warning_locally_suppressed") } + + @Test def test_schema_warning_escalated_to_error(): Unit = { + runner.runOneTest("schema_warning_escalated_to_error") + } }