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 | 7d82da7 | 2019-04-11 15:16:38 +0200 | [diff] [blame] | 83 | 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át | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 97 | |
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át | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 141 | |
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át | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 205 | } |