summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorgjoranv <gjoranv@gmail.com>2017-08-15 13:25:40 +0200
committerGitHub <noreply@github.com>2017-08-15 13:25:40 +0200
commit9c3a709079f2c8e6f243fe00cd6a087f62a42a21 (patch)
treeebb0af966325f24387f637d59c4e6c662b735f0a /config-model
parentd1d8f82a398371483a0ba4634215f255acc6b78e (diff)
parent463a3493d68f4e55930a570617334a9541385ad5 (diff)
Merge pull request #3033 from vespa-engine/bratseth/validate-validation-override
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