Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 1 | module example-schema { |
2 | prefix aha; | ||||
3 | namespace "http://example.com"; | ||||
4 | |||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 5 | import other-module { |
6 | prefix other; | ||||
7 | } | ||||
8 | |||||
Václav Kubernát | da8e4b9 | 2020-02-04 11:56:30 +0100 | [diff] [blame] | 9 | container inventory { |
10 | container stuff { | ||||
11 | presence true; | ||||
12 | } | ||||
13 | } | ||||
14 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 15 | leaf leafUInt8 { |
16 | type uint8; | ||||
17 | } | ||||
18 | |||||
19 | leaf leafUInt16 { | ||||
20 | type uint16; | ||||
21 | } | ||||
22 | |||||
23 | leaf leafUInt32 { | ||||
24 | type uint32; | ||||
25 | } | ||||
26 | |||||
27 | leaf leafUInt64 { | ||||
28 | type uint64; | ||||
29 | } | ||||
30 | |||||
31 | leaf leafInt8 { | ||||
32 | type int8; | ||||
33 | } | ||||
34 | |||||
35 | leaf leafInt16 { | ||||
36 | type int16; | ||||
37 | } | ||||
38 | |||||
39 | leaf leafInt32 { | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 40 | type int32; |
41 | } | ||||
42 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 43 | leaf leafInt64 { |
44 | type int64; | ||||
45 | } | ||||
46 | |||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 47 | leaf leafString { |
48 | type string; | ||||
49 | } | ||||
50 | |||||
51 | leaf leafEnum { | ||||
52 | type enumeration { | ||||
53 | enum lol; | ||||
54 | enum data; | ||||
55 | enum coze; | ||||
56 | } | ||||
57 | } | ||||
58 | |||||
59 | leaf leafDecimal { | ||||
Václav Kubernát | 9cfcd87 | 2020-02-18 12:34:02 +0100 | [diff] [blame] | 60 | units "nm"; |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 61 | type decimal64 { |
62 | fraction-digits 9; | ||||
63 | } | ||||
64 | } | ||||
65 | |||||
66 | container pContainer { | ||||
67 | presence true; | ||||
68 | } | ||||
69 | |||||
Václav Kubernát | 45f4a82 | 2019-05-29 21:10:50 +0200 | [diff] [blame] | 70 | list person { |
71 | key 'name'; | ||||
72 | leaf name { | ||||
73 | type string; | ||||
74 | } | ||||
75 | } | ||||
76 | |||||
Václav Kubernát | 3efb5ca | 2019-10-09 20:07:40 +0200 | [diff] [blame] | 77 | leaf bossPerson { |
78 | type leafref { | ||||
79 | path '../aha:person/name'; | ||||
80 | } | ||||
81 | } | ||||
82 | |||||
Václav Kubernát | 2984f44 | 2020-02-20 17:43:35 +0100 | [diff] [blame] | 83 | leaf unionIntString { |
84 | type union { | ||||
85 | type int32; | ||||
86 | type string; | ||||
87 | } | ||||
88 | } | ||||
89 | |||||
Václav Kubernát | 7d82da7 | 2019-04-11 15:16:38 +0200 | [diff] [blame] | 90 | grouping upAndDown { |
91 | leaf up { | ||||
92 | type boolean; | ||||
93 | } | ||||
94 | leaf down { | ||||
95 | type boolean; | ||||
96 | } | ||||
97 | } | ||||
98 | |||||
99 | uses upAndDown; | ||||
100 | |||||
101 | container lol { | ||||
102 | uses upAndDown; | ||||
103 | } | ||||
Jan Kundrát | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 104 | |
105 | grouping targets_def { | ||||
106 | list targets { | ||||
107 | key 'city'; | ||||
108 | leaf city { | ||||
109 | type string; | ||||
110 | } | ||||
111 | } | ||||
112 | } | ||||
113 | |||||
Václav Kubernát | e7248b2 | 2020-06-26 15:38:59 +0200 | [diff] [blame^] | 114 | rpc fire { |
115 | input { | ||||
116 | leaf whom { | ||||
117 | type leafref { | ||||
118 | path '/aha:person/name'; | ||||
119 | } | ||||
120 | } | ||||
121 | } | ||||
122 | } | ||||
123 | |||||
Jan Kundrát | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 124 | rpc launch-nukes { |
125 | input { | ||||
126 | container payload { | ||||
127 | leaf kilotons { | ||||
128 | type uint64; | ||||
129 | mandatory true; | ||||
130 | units "kilotons"; | ||||
131 | } | ||||
132 | } | ||||
133 | leaf description { | ||||
134 | type string; | ||||
135 | } | ||||
136 | container cities { | ||||
137 | presence true; | ||||
138 | uses targets_def; | ||||
139 | } | ||||
140 | } | ||||
141 | output { | ||||
142 | leaf blast-radius { | ||||
143 | type uint32; | ||||
144 | units "m"; | ||||
145 | } | ||||
146 | leaf actual-yield { | ||||
147 | type uint64; | ||||
148 | units "kilotons"; | ||||
149 | } | ||||
150 | container damaged-places { | ||||
151 | presence true; | ||||
152 | uses targets_def; | ||||
153 | } | ||||
154 | } | ||||
155 | } | ||||
156 | |||||
157 | rpc noop {} | ||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 158 | |
159 | list selectedNumbers { | ||||
160 | key 'value'; | ||||
161 | leaf value { | ||||
162 | type int8; | ||||
163 | } | ||||
164 | } | ||||
165 | |||||
166 | list animalWithColor { | ||||
167 | key 'name color'; | ||||
168 | leaf name { | ||||
169 | type string; | ||||
170 | } | ||||
171 | leaf color { | ||||
172 | type string; | ||||
173 | } | ||||
174 | } | ||||
175 | |||||
176 | list ports { | ||||
177 | key 'name'; | ||||
178 | leaf name { | ||||
179 | type enumeration { | ||||
180 | enum A; | ||||
181 | enum B; | ||||
182 | enum C; | ||||
183 | enum D; | ||||
184 | enum E; | ||||
185 | } | ||||
186 | } | ||||
187 | } | ||||
188 | |||||
189 | list org { | ||||
190 | key 'department'; | ||||
191 | leaf department { | ||||
192 | type string; | ||||
193 | } | ||||
194 | |||||
195 | list people { | ||||
196 | key 'name'; | ||||
197 | leaf name { | ||||
198 | type string; | ||||
199 | } | ||||
200 | |||||
201 | list computers { | ||||
202 | key 'type'; | ||||
203 | leaf type { | ||||
204 | type enumeration { | ||||
205 | enum PC; | ||||
206 | enum laptop; | ||||
207 | enum server; | ||||
208 | } | ||||
209 | } | ||||
210 | } | ||||
211 | } | ||||
212 | } | ||||
213 | |||||
214 | augment "/other:parking-lot" { | ||||
215 | list cars { | ||||
216 | key 'id'; | ||||
217 | leaf id { | ||||
218 | type int32; | ||||
219 | } | ||||
220 | } | ||||
221 | } | ||||
Jan Kundrát | bb525b4 | 2020-02-04 11:56:59 +0100 | [diff] [blame] | 222 | |
223 | leaf temperature { | ||||
224 | type int32; | ||||
225 | config false; | ||||
226 | } | ||||
Jan Kundrát | 0d8abd1 | 2020-05-07 02:00:14 +0200 | [diff] [blame] | 227 | |
228 | identity Animal { | ||||
229 | } | ||||
230 | |||||
231 | identity Mammal { | ||||
232 | base "Animal"; | ||||
233 | } | ||||
234 | |||||
235 | identity Dog { | ||||
236 | base "Mammal"; | ||||
237 | } | ||||
238 | |||||
239 | identity Whale { | ||||
240 | base "Mammal"; | ||||
241 | } | ||||
242 | |||||
243 | identity Velociraptor { | ||||
244 | base "Animal"; | ||||
245 | } | ||||
246 | |||||
247 | leaf beast { | ||||
248 | type identityref { | ||||
249 | base "Animal"; | ||||
250 | } | ||||
251 | } | ||||
Jan Kundrát | 6898544 | 2020-05-07 02:15:34 +0200 | [diff] [blame] | 252 | |
253 | leaf blob { | ||||
254 | type binary; | ||||
255 | } | ||||
Jan Kundrát | 379bb57 | 2020-05-07 03:23:13 +0200 | [diff] [blame] | 256 | |
257 | leaf dummy { | ||||
258 | type empty; | ||||
259 | } | ||||
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 260 | |
261 | leaf-list addresses { | ||||
262 | type string; | ||||
263 | } | ||||
Václav Kubernát | bf65dd7 | 2020-05-28 02:32:31 +0200 | [diff] [blame] | 264 | |
265 | leaf-list protocols { | ||||
266 | type string; | ||||
267 | ordered-by user; | ||||
268 | } | ||||
269 | |||||
270 | list players { | ||||
271 | key "name"; | ||||
272 | ordered-by user; | ||||
273 | leaf name { | ||||
274 | type string; | ||||
275 | } | ||||
276 | } | ||||
Václav Kubernát | 70d7f7a | 2020-06-23 14:40:40 +0200 | [diff] [blame] | 277 | |
278 | list point { | ||||
279 | key "x y"; | ||||
280 | leaf x { | ||||
281 | type int32; | ||||
282 | } | ||||
283 | leaf y { | ||||
284 | type int32; | ||||
285 | } | ||||
286 | } | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 287 | } |