blob: cbd5d8d8a27629575801a510ff2e2a7c7002efce [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 {
60 type decimal64 {
61 fraction-digits 9;
62 }
63 }
64
65 container pContainer {
66 presence true;
67 }
68
Václav Kubernát45f4a822019-05-29 21:10:50 +020069 list person {
70 key 'name';
71 leaf name {
72 type string;
73 }
74 }
75
Václav Kubernát3efb5ca2019-10-09 20:07:40 +020076 leaf bossPerson {
77 type leafref {
78 path '../aha:person/name';
79 }
80 }
81
Václav Kubernát7d82da72019-04-11 15:16:38 +020082 grouping upAndDown {
83 leaf up {
84 type boolean;
85 }
86 leaf down {
87 type boolean;
88 }
89 }
90
91 uses upAndDown;
92
93 container lol {
94 uses upAndDown;
95 }
Jan Kundrát6ee84792020-01-24 01:43:36 +010096
97 grouping targets_def {
98 list targets {
99 key 'city';
100 leaf city {
101 type string;
102 }
103 }
104 }
105
106 rpc launch-nukes {
107 input {
108 container payload {
109 leaf kilotons {
110 type uint64;
111 mandatory true;
112 units "kilotons";
113 }
114 }
115 leaf description {
116 type string;
117 }
118 container cities {
119 presence true;
120 uses targets_def;
121 }
122 }
123 output {
124 leaf blast-radius {
125 type uint32;
126 units "m";
127 }
128 leaf actual-yield {
129 type uint64;
130 units "kilotons";
131 }
132 container damaged-places {
133 presence true;
134 uses targets_def;
135 }
136 }
137 }
138
139 rpc noop {}
Václav Kubernátab612e92019-11-26 19:51:31 +0100140
141 list selectedNumbers {
142 key 'value';
143 leaf value {
144 type int8;
145 }
146 }
147
148 list animalWithColor {
149 key 'name color';
150 leaf name {
151 type string;
152 }
153 leaf color {
154 type string;
155 }
156 }
157
158 list ports {
159 key 'name';
160 leaf name {
161 type enumeration {
162 enum A;
163 enum B;
164 enum C;
165 enum D;
166 enum E;
167 }
168 }
169 }
170
171 list org {
172 key 'department';
173 leaf department {
174 type string;
175 }
176
177 list people {
178 key 'name';
179 leaf name {
180 type string;
181 }
182
183 list computers {
184 key 'type';
185 leaf type {
186 type enumeration {
187 enum PC;
188 enum laptop;
189 enum server;
190 }
191 }
192 }
193 }
194 }
195
196 augment "/other:parking-lot" {
197 list cars {
198 key 'id';
199 leaf id {
200 type int32;
201 }
202 }
203 }
Václav Kubernát73109382018-09-14 19:52:03 +0200204}