Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 1 | module example-schema { |
2 | prefix aha; | ||||
3 | namespace "http://example.com"; | ||||
4 | |||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 5 | import other-module { |
6 | prefix other; | ||||
7 | } | ||||
8 | |||||
Václav Kubernát | da8e4b9 | 2020-02-04 11:56:30 +0100 | [diff] [blame] | 9 | container inventory { |
10 | container stuff { | ||||
11 | presence true; | ||||
12 | } | ||||
13 | } | ||||
14 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 15 | 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át | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 40 | type int32; |
41 | } | ||||
42 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 43 | leaf leafInt64 { |
44 | type int64; | ||||
45 | } | ||||
46 | |||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 47 | 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át | 9cfcd87 | 2020-02-18 12:34:02 +0100 | [diff] [blame] | 60 | units "nm"; |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 61 | type decimal64 { |
62 | fraction-digits 9; | ||||
63 | } | ||||
64 | } | ||||
65 | |||||
66 | container pContainer { | ||||
67 | presence true; | ||||
68 | } | ||||
69 | |||||
Václav Kubernát | 45f4a82 | 2019-05-29 21:10:50 +0200 | [diff] [blame] | 70 | list person { |
71 | key 'name'; | ||||
72 | leaf name { | ||||
73 | type string; | ||||
74 | } | ||||
75 | } | ||||
76 | |||||
Václav Kubernát | 3efb5ca | 2019-10-09 20:07:40 +0200 | [diff] [blame] | 77 | leaf bossPerson { |
78 | type leafref { | ||||
79 | path '../aha:person/name'; | ||||
80 | } | ||||
81 | } | ||||
82 | |||||
Václav Kubernát | 2984f44 | 2020-02-20 17:43:35 +0100 | [diff] [blame] | 83 | leaf unionIntString { |
84 | type union { | ||||
85 | type int32; | ||||
86 | type string; | ||||
87 | } | ||||
88 | } | ||||
89 | |||||
Václav Kubernát | 7d82da7 | 2019-04-11 15:16:38 +0200 | [diff] [blame] | 90 | 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át | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 104 | |
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át | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 148 | |
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át | bb525b4 | 2020-02-04 11:56:59 +0100 | [diff] [blame^] | 212 | |
213 | leaf temperature { | ||||
214 | type int32; | ||||
215 | config false; | ||||
216 | } | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 217 | } |