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 | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 5 | leaf leafUInt8 { |
6 | type uint8; | ||||
7 | } | ||||
8 | |||||
9 | leaf leafUInt16 { | ||||
10 | type uint16; | ||||
11 | } | ||||
12 | |||||
13 | leaf leafUInt32 { | ||||
14 | type uint32; | ||||
15 | } | ||||
16 | |||||
17 | leaf leafUInt64 { | ||||
18 | type uint64; | ||||
19 | } | ||||
20 | |||||
21 | leaf leafInt8 { | ||||
22 | type int8; | ||||
23 | } | ||||
24 | |||||
25 | leaf leafInt16 { | ||||
26 | type int16; | ||||
27 | } | ||||
28 | |||||
29 | leaf leafInt32 { | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 30 | type int32; |
31 | } | ||||
32 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 33 | leaf leafInt64 { |
34 | type int64; | ||||
35 | } | ||||
36 | |||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 37 | leaf leafString { |
38 | type string; | ||||
39 | } | ||||
40 | |||||
41 | leaf leafEnum { | ||||
42 | type enumeration { | ||||
43 | enum lol; | ||||
44 | enum data; | ||||
45 | enum coze; | ||||
46 | } | ||||
47 | } | ||||
48 | |||||
49 | leaf leafDecimal { | ||||
50 | type decimal64 { | ||||
51 | fraction-digits 9; | ||||
52 | } | ||||
53 | } | ||||
54 | |||||
55 | container pContainer { | ||||
56 | presence true; | ||||
57 | } | ||||
58 | |||||
Václav Kubernát | 45f4a82 | 2019-05-29 21:10:50 +0200 | [diff] [blame] | 59 | list person { |
60 | key 'name'; | ||||
61 | leaf name { | ||||
62 | type string; | ||||
63 | } | ||||
64 | } | ||||
65 | |||||
Václav Kubernát | 3efb5ca | 2019-10-09 20:07:40 +0200 | [diff] [blame] | 66 | leaf bossPerson { |
67 | type leafref { | ||||
68 | path '../aha:person/name'; | ||||
69 | } | ||||
70 | } | ||||
71 | |||||
Václav Kubernát | 7d82da7 | 2019-04-11 15:16:38 +0200 | [diff] [blame] | 72 | grouping upAndDown { |
73 | leaf up { | ||||
74 | type boolean; | ||||
75 | } | ||||
76 | leaf down { | ||||
77 | type boolean; | ||||
78 | } | ||||
79 | } | ||||
80 | |||||
81 | uses upAndDown; | ||||
82 | |||||
83 | container lol { | ||||
84 | uses upAndDown; | ||||
85 | } | ||||
Jan Kundrát | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 86 | |
87 | grouping targets_def { | ||||
88 | list targets { | ||||
89 | key 'city'; | ||||
90 | leaf city { | ||||
91 | type string; | ||||
92 | } | ||||
93 | } | ||||
94 | } | ||||
95 | |||||
96 | rpc launch-nukes { | ||||
97 | input { | ||||
98 | container payload { | ||||
99 | leaf kilotons { | ||||
100 | type uint64; | ||||
101 | mandatory true; | ||||
102 | units "kilotons"; | ||||
103 | } | ||||
104 | } | ||||
105 | leaf description { | ||||
106 | type string; | ||||
107 | } | ||||
108 | container cities { | ||||
109 | presence true; | ||||
110 | uses targets_def; | ||||
111 | } | ||||
112 | } | ||||
113 | output { | ||||
114 | leaf blast-radius { | ||||
115 | type uint32; | ||||
116 | units "m"; | ||||
117 | } | ||||
118 | leaf actual-yield { | ||||
119 | type uint64; | ||||
120 | units "kilotons"; | ||||
121 | } | ||||
122 | container damaged-places { | ||||
123 | presence true; | ||||
124 | uses targets_def; | ||||
125 | } | ||||
126 | } | ||||
127 | } | ||||
128 | |||||
129 | rpc noop {} | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 130 | } |