blob: f876779470998777844965a0d08f1748a2ff9c37 [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át7d82da72019-04-11 15:16:38 +020083 grouping upAndDown {
84 leaf up {
85 type boolean;
86 }
87 leaf down {
88 type boolean;
89 }
90 }
91
92 uses upAndDown;
93
94 container lol {
95 uses upAndDown;
96 }
Jan Kundrát6ee84792020-01-24 01:43:36 +010097
98 grouping targets_def {
99 list targets {
100 key 'city';
101 leaf city {
102 type string;
103 }
104 }
105 }
106
107 rpc launch-nukes {
108 input {
109 container payload {
110 leaf kilotons {
111 type uint64;
112 mandatory true;
113 units "kilotons";
114 }
115 }
116 leaf description {
117 type string;
118 }
119 container cities {
120 presence true;
121 uses targets_def;
122 }
123 }
124 output {
125 leaf blast-radius {
126 type uint32;
127 units "m";
128 }
129 leaf actual-yield {
130 type uint64;
131 units "kilotons";
132 }
133 container damaged-places {
134 presence true;
135 uses targets_def;
136 }
137 }
138 }
139
140 rpc noop {}
Václav Kubernátab612e92019-11-26 19:51:31 +0100141
142 list selectedNumbers {
143 key 'value';
144 leaf value {
145 type int8;
146 }
147 }
148
149 list animalWithColor {
150 key 'name color';
151 leaf name {
152 type string;
153 }
154 leaf color {
155 type string;
156 }
157 }
158
159 list ports {
160 key 'name';
161 leaf name {
162 type enumeration {
163 enum A;
164 enum B;
165 enum C;
166 enum D;
167 enum E;
168 }
169 }
170 }
171
172 list org {
173 key 'department';
174 leaf department {
175 type string;
176 }
177
178 list people {
179 key 'name';
180 leaf name {
181 type string;
182 }
183
184 list computers {
185 key 'type';
186 leaf type {
187 type enumeration {
188 enum PC;
189 enum laptop;
190 enum server;
191 }
192 }
193 }
194 }
195 }
196
197 augment "/other:parking-lot" {
198 list cars {
199 key 'id';
200 leaf id {
201 type int32;
202 }
203 }
204 }
Václav Kubernát73109382018-09-14 19:52:03 +0200205}