summaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-06-23 21:02:07 -0500
committerGitHub <noreply@github.com>2021-06-23 21:02:07 -0500
commit1a7362622783804c72862e84b68bf065b1dabc19 (patch)
tree7a386e52ea9122966619f14c29a79d97cc82dda0 /schema
parentd48dddab0509e562209adfb115b0e691b8e47f54 (diff)
parent59a4aadfe419eca16e6288b37d6c51acd9789903 (diff)
downloadvyos-1x-1a7362622783804c72862e84b68bf065b1dabc19.tar.gz
vyos-1x-1a7362622783804c72862e84b68bf065b1dabc19.zip
Merge pull request #869 from jestabro/T3574
T3574: add constraintGroup to schema and build-command-templates
Diffstat (limited to 'schema')
-rw-r--r--schema/interface_definition.rnc11
-rw-r--r--schema/interface_definition.rng21
2 files changed, 32 insertions, 0 deletions
diff --git a/schema/interface_definition.rnc b/schema/interface_definition.rnc
index 6647f5e11..d7fc4966c 100644
--- a/schema/interface_definition.rnc
+++ b/schema/interface_definition.rnc
@@ -93,6 +93,7 @@ properties = element properties
{
help? &
constraint? &
+ constraintGroup* &
valueHelp* &
(element constraintErrorMessage { text })? &
completionHelp* &
@@ -140,6 +141,16 @@ constraint = element constraint
validator )+
}
+# Tag and leaf nodes may have constraintGroups on their names and
+# values (respectively).
+# When multiple constraints are listed within a group, they work as
+# logical AND
+constraintGroup = element constraintGroup
+{
+ ( (element regex { text }) |
+ validator )+
+}
+
# A constraint may also use an external validator rather than regex
validator = element validator
{
diff --git a/schema/interface_definition.rng b/schema/interface_definition.rng
index 22e886006..3ff60cf18 100644
--- a/schema/interface_definition.rng
+++ b/schema/interface_definition.rng
@@ -161,6 +161,9 @@
<ref name="constraint"/>
</optional>
<zeroOrMore>
+ <ref name="constraintGroup"/>
+ </zeroOrMore>
+ <zeroOrMore>
<ref name="valueHelp"/>
</zeroOrMore>
<optional>
@@ -244,6 +247,24 @@
</oneOrMore>
</element>
</define>
+ <!--
+ Tag and leaf nodes may have constraintGroups on their names and
+ values (respectively).
+ When multiple constraints are listed within a group, they work as
+ logical AND
+ -->
+ <define name="constraintGroup">
+ <element name="constraintGroup">
+ <oneOrMore>
+ <choice>
+ <element name="regex">
+ <text/>
+ </element>
+ <ref name="validator"/>
+ </choice>
+ </oneOrMore>
+ </element>
+ </define>
<!-- A constraint may also use an external validator rather than regex -->
<define name="validator">
<element name="validator">