blob: a7ff3d86b0832ec2aac293e27761bc60834beba9 [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át134d78f2019-09-03 16:42:29 +02009 leaf leafUInt8 {
10 type uint8;
11 }
12
13 leaf leafUInt16 {
14 type uint16;
15 }
16
17 leaf leafUInt32 {
18 type uint32;
19 }
20
21 leaf leafUInt64 {
22 type uint64;
23 }
24
25 leaf leafInt8 {
26 type int8;
27 }
28
29 leaf leafInt16 {
30 type int16;
31 }
32
33 leaf leafInt32 {
Václav Kubernát73109382018-09-14 19:52:03 +020034 type int32;
35 }
36
Václav Kubernát134d78f2019-09-03 16:42:29 +020037 leaf leafInt64 {
38 type int64;
39 }
40
Václav Kubernát73109382018-09-14 19:52:03 +020041 leaf leafString {
42 type string;
43 }
44
45 leaf leafEnum {
46 type enumeration {
47 enum lol;
48 enum data;
49 enum coze;
50 }
51 }
52
53 leaf leafDecimal {
54 type decimal64 {
55 fraction-digits 9;
56 }
57 }
58
59 container pContainer {
60 presence true;
61 }
62
Václav Kubernát45f4a822019-05-29 21:10:50 +020063 list person {
64 key 'name';
65 leaf name {
66 type string;
67 }
68 }
69
Václav Kubernát3efb5ca2019-10-09 20:07:40 +020070 leaf bossPerson {
71 type leafref {
72 path '../aha:person/name';
73 }
74 }
75
Václav Kubernát7d82da72019-04-11 15:16:38 +020076 grouping upAndDown {
77 leaf up {
78 type boolean;
79 }
80 leaf down {
81 type boolean;
82 }
83 }
84
85 uses upAndDown;
86
87 container lol {
88 uses upAndDown;
89 }
Jan Kundrát6ee84792020-01-24 01:43:36 +010090
91 grouping targets_def {
92 list targets {
93 key 'city';
94 leaf city {
95 type string;
96 }
97 }
98 }
99
100 rpc launch-nukes {
101 input {
102 container payload {
103 leaf kilotons {
104 type uint64;
105 mandatory true;
106 units "kilotons";
107 }
108 }
109 leaf description {
110 type string;
111 }
112 container cities {
113 presence true;
114 uses targets_def;
115 }
116 }
117 output {
118 leaf blast-radius {
119 type uint32;
120 units "m";
121 }
122 leaf actual-yield {
123 type uint64;
124 units "kilotons";
125 }
126 container damaged-places {
127 presence true;
128 uses targets_def;
129 }
130 }
131 }
132
133 rpc noop {}
Václav Kubernátab612e92019-11-26 19:51:31 +0100134
135 list selectedNumbers {
136 key 'value';
137 leaf value {
138 type int8;
139 }
140 }
141
142 list animalWithColor {
143 key 'name color';
144 leaf name {
145 type string;
146 }
147 leaf color {
148 type string;
149 }
150 }
151
152 list ports {
153 key 'name';
154 leaf name {
155 type enumeration {
156 enum A;
157 enum B;
158 enum C;
159 enum D;
160 enum E;
161 }
162 }
163 }
164
165 list org {
166 key 'department';
167 leaf department {
168 type string;
169 }
170
171 list people {
172 key 'name';
173 leaf name {
174 type string;
175 }
176
177 list computers {
178 key 'type';
179 leaf type {
180 type enumeration {
181 enum PC;
182 enum laptop;
183 enum server;
184 }
185 }
186 }
187 }
188 }
189
190 augment "/other:parking-lot" {
191 list cars {
192 key 'id';
193 leaf id {
194 type int32;
195 }
196 }
197 }
Václav Kubernát73109382018-09-14 19:52:03 +0200198}