blob: ac7724a2af150c3834c953f988a1f30d227071f2 [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
114 rpc launch-nukes {
115 input {
116 container payload {
117 leaf kilotons {
118 type uint64;
119 mandatory true;
120 units "kilotons";
121 }
122 }
123 leaf description {
124 type string;
125 }
126 container cities {
127 presence true;
128 uses targets_def;
129 }
130 }
131 output {
132 leaf blast-radius {
133 type uint32;
134 units "m";
135 }
136 leaf actual-yield {
137 type uint64;
138 units "kilotons";
139 }
140 container damaged-places {
141 presence true;
142 uses targets_def;
143 }
144 }
145 }
146
147 rpc noop {}
Václav Kubernátab612e92019-11-26 19:51:31 +0100148
149 list selectedNumbers {
150 key 'value';
151 leaf value {
152 type int8;
153 }
154 }
155
156 list animalWithColor {
157 key 'name color';
158 leaf name {
159 type string;
160 }
161 leaf color {
162 type string;
163 }
164 }
165
166 list ports {
167 key 'name';
168 leaf name {
169 type enumeration {
170 enum A;
171 enum B;
172 enum C;
173 enum D;
174 enum E;
175 }
176 }
177 }
178
179 list org {
180 key 'department';
181 leaf department {
182 type string;
183 }
184
185 list people {
186 key 'name';
187 leaf name {
188 type string;
189 }
190
191 list computers {
192 key 'type';
193 leaf type {
194 type enumeration {
195 enum PC;
196 enum laptop;
197 enum server;
198 }
199 }
200 }
201 }
202 }
203
204 augment "/other:parking-lot" {
205 list cars {
206 key 'id';
207 leaf id {
208 type int32;
209 }
210 }
211 }
Jan Kundrátbb525b42020-02-04 11:56:59 +0100212
213 leaf temperature {
214 type int32;
215 config false;
216 }
Václav Kubernát73109382018-09-14 19:52:03 +0200217}