Skip to content

Commit 4e8c8a4

Browse files
committed
T6342: extend schema to handle documentation in the xml interface definition
1 parent 7bf02bf commit 4e8c8a4

File tree

2 files changed

+51
-6
lines changed

2 files changed

+51
-6
lines changed

schema/interface_definition.rnc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ properties = element properties
9797
valueHelp* &
9898
(element constraintErrorMessage { text })? &
9999
completionHelp* &
100+
101+
# "docs" is used to store documentation for a node in a structured format
102+
# It is used to generate documentation for the CLI and Web docs
103+
(element docs {
104+
(element headline { text })? &
105+
(element text { text })? &
106+
(element usageExample { text })? &
107+
(element hints {
108+
attribute type { text },
109+
text
110+
})*
111+
})? &
100112

101113
# These are meaningful only for leaf nodes
102114
(element valueless { empty })? &

schema/interface_definition.rng

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
33
<!--
44
interface_definition.rnc: VyConf reference tree XML grammar
5-
5+
66
Copyright (C) 2014. 2017 VyOS maintainers and contributors <maintainers@vyos.net>
7-
7+
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
1010
License as published by the Free Software Foundation; either
1111
version 2.1 of the License, or (at your option) any later version.
12-
12+
1313
This library is distributed in the hope that it will be useful,
1414
but WITHOUT ANY WARRANTY; without even the implied warranty of
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1616
Lesser General Public License for more details.
17-
17+
1818
You should have received a copy of the GNU Lesser General Public
1919
License along with this library; if not, write to the Free Software
2020
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
@@ -142,15 +142,15 @@
142142
Nodes may have properties
143143
For simplicity, any property is allowed in any node,
144144
but whether they are used or not is implementation-defined
145-
145+
146146
Leaf nodes may differ in number of values that can be
147147
associated with them.
148148
By default, a leaf node can have only one value.
149149
"multi" tag means a node can have one or more values,
150150
"valueless" means it can have no values at all.
151151
"hidden" means node visibility can be toggled, eg 'dangerous' commands,
152152
"secret" allows a node to hide its value from unprivileged users.
153-
153+
154154
"priority" is used to influence node processing order for nodes
155155
with exact same dependencies and in compatibility modes.
156156
-->
@@ -177,6 +177,39 @@
177177
<zeroOrMore>
178178
<ref name="completionHelp"/>
179179
</zeroOrMore>
180+
<optional>
181+
<!--
182+
"docs" is used to store documentation for a node in a structured format
183+
It is used to generate documentation for the CLI and Web docs
184+
-->
185+
<group>
186+
<element name="docs">
187+
<interleave>
188+
<optional>
189+
<element name="headline">
190+
<text/>
191+
</element>
192+
</optional>
193+
<optional>
194+
<element name="text">
195+
<text/>
196+
</element>
197+
</optional>
198+
<optional>
199+
<element name="usageExample">
200+
<text/>
201+
</element>
202+
</optional>
203+
<zeroOrMore>
204+
<element name="hints">
205+
<attribute name="type"/>
206+
<text/>
207+
</element>
208+
</zeroOrMore>
209+
</interleave>
210+
</element>
211+
</group>
212+
</optional>
180213
<optional>
181214
<!-- These are meaningful only for leaf nodes -->
182215
<group>

0 commit comments

Comments
 (0)