blob: 04ae22da4b6e47f3350d2eaea1428ba2eeb9f6f7 [file] [log] [blame]
Václav Kubernát73109382018-09-14 19:52:03 +02001module example-schema {
2 prefix aha;
3 namespace "http://example.com";
4
Václav Kubernátab612e92019-11-26 19:51:31 +01005 import other-module {
6 prefix other;
7 }
8
Václav Kubernátda8e4b92020-02-04 11:56:30 +01009 container inventory {
10 container stuff {
11 presence true;
12 }
13 }
14
Václav Kubernát134d78f2019-09-03 16:42:29 +020015 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át73109382018-09-14 19:52:03 +020040 type int32;
41 }
42
Václav Kubernát134d78f2019-09-03 16:42:29 +020043 leaf leafInt64 {
44 type int64;
45 }
46
Václav Kubernát73109382018-09-14 19:52:03 +020047 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át9cfcd872020-02-18 12:34:02 +010060 units "nm";
Václav Kubernát73109382018-09-14 19:52:03 +020061 type decimal64 {
62 fraction-digits 9;
63 }
64 }
65
66 container pContainer {
67 presence true;
68 }
69
Václav Kubernát45f4a822019-05-29 21:10:50 +020070 list person {
71 key 'name';
72 leaf name {
73 type string;
74 }
75 }
76
Václav Kubernát3efb5ca2019-10-09 20:07:40 +020077 leaf bossPerson {
78 type leafref {
79 path '../aha:person/name';
80 }
81 }
82
Václav Kubernát2984f442020-02-20 17:43:35 +010083 leaf unionIntString {
84 type union {
85 type int32;
86 type string;
87 }
88 }
89
Václav Kubernát7d82da72019-04-11 15:16:38 +020090 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át6ee84792020-01-24 01:43:36 +0100104
105 grouping targets_def {
106 list targets {
107 key 'city';
108 leaf city {
109 type string;
110 }
111 }
112 }
113
Václav Kubernáte7248b22020-06-26 15:38:59 +0200114 rpc fire {
115 input {
116 leaf whom {
117 type leafref {
118 path '/aha:person/name';
119 }
120 }
121 }
122 }
123
Jan Kundrát6ee84792020-01-24 01:43:36 +0100124 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átab612e92019-11-26 19:51:31 +0100158
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átbb525b42020-02-04 11:56:59 +0100222
223 leaf temperature {
224 type int32;
225 config false;
226 }
Jan Kundrát0d8abd12020-05-07 02:00:14 +0200227
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át68985442020-05-07 02:15:34 +0200252
253 leaf blob {
254 type binary;
255 }
Jan Kundrát379bb572020-05-07 03:23:13 +0200256
257 leaf dummy {
258 type empty;
259 }
Václav Kubernát5b8a8f32020-05-20 00:57:22 +0200260
261 leaf-list addresses {
262 type string;
263 }
Václav Kubernátbf65dd72020-05-28 02:32:31 +0200264
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át70d7f7a2020-06-23 14:40:40 +0200277
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át73109382018-09-14 19:52:03 +0200287}