aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-07-31 16:53:06 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2017-07-31 16:53:06 +0200
commit463a3493d68f4e55930a570617334a9541385ad5 (patch)
tree7abb5c3d0123d0a79a598c36875594a7b7f697d3 /config-model
parentb4fc7b0ea0f710b04ebe64c6c4a9f981b6b0c25d (diff)
Validate validation-overrides.xml files
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/Makefile6
-rw-r--r--config-model/src/main/resources/schema/validation-overrides.rnc13
-rw-r--r--config-model/src/test/schema-test-files/validation-overrides.xml4
-rwxr-xr-xconfig-model/src/test/sh/test-schema.sh4
4 files changed, 27 insertions, 0 deletions
diff --git a/config-model/src/main/Makefile b/config-model/src/main/Makefile
index dea2aa9e9fe..b1c37f4889f 100644
--- a/config-model/src/main/Makefile
+++ b/config-model/src/main/Makefile
@@ -31,6 +31,12 @@ resources/schema/deployment.rng: resources/schema/deployment.rnc
resources/schema/deployment.xsd: resources/schema/deployment.rng
java -jar $(trangjar) -I rng -O xsd resources/schema/deployment.rng resources/schema/deployment.xsd
+resources/schema/validation-overrides.rng: resources/schema/validation-overrides.rnc
+ java -jar $(trangjar) -I rnc -O rng resources/schema/validation-overrides.rnc resources/schema/validation-overrides.rng
+
+resources/schema/deployment.xsd: resources/schema/validation-overrides.rng
+ java -jar $(trangjar) -I rng -O xsd resources/schema/validation-overrides.rng resources/schema/validation-overrides.xsd
+
clean:
rm -f resources/schema/*.rng
rm -f resources/schema/*.xsd
diff --git a/config-model/src/main/resources/schema/validation-overrides.rnc b/config-model/src/main/resources/schema/validation-overrides.rnc
new file mode 100644
index 00000000000..f5af03f7f03
--- /dev/null
+++ b/config-model/src/main/resources/schema/validation-overrides.rnc
@@ -0,0 +1,13 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+# RELAX NG Compact Syntax
+# Vespa validation overrides
+
+start = element validation-overrides {
+ Allow*
+}
+
+Allow = element allow {
+ attribute until { xsd:string } &
+ attribute comment { xsd:string }? &
+ text
+}
diff --git a/config-model/src/test/schema-test-files/validation-overrides.xml b/config-model/src/test/schema-test-files/validation-overrides.xml
new file mode 100644
index 00000000000..3b8b4f290be
--- /dev/null
+++ b/config-model/src/test/schema-test-files/validation-overrides.xml
@@ -0,0 +1,4 @@
+<validation-overrides>
+ <allow until="2017-01-01" comment="Some change">field-type-change</allow>
+ <allow until="2017-02-01">cluster-size-reduction</allow>
+</validation-overrides>
diff --git a/config-model/src/test/sh/test-schema.sh b/config-model/src/test/sh/test-schema.sh
index 535a7008589..ad2a8a81117 100755
--- a/config-model/src/test/sh/test-schema.sh
+++ b/config-model/src/test/sh/test-schema.sh
@@ -31,3 +31,7 @@ $cmd
cmd="java -jar $jar src/main/resources/schema/deployment.rng src/test/schema-test-files/deployment.xml"
echo $cmd
$cmd
+
+cmd="java -jar $jar src/main/resources/schema/validation-overrides.rng src/test/schema-test-files/validation-overrides.xml"
+echo $cmd
+$cmd