config.py: remove bit array field type's byte order property
[deliverable/barectf.git] / barectf / schemas / config / 3 / field-type.yaml
CommitLineData
4810b707
PP
1# The MIT License (MIT)
2#
3# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
4#
5# Permission is hereby granted, free of charge, to any person obtaining
6# a copy of this software and associated documentation files (the
7# "Software"), to deal in the Software without restriction, including
8# without limitation the rights to use, copy, modify, merge, publish,
9# distribute, sublicense, and/or sell copies of the Software, and to
10# permit persons to whom the Software is furnished to do so, subject to
11# the following conditions:
12#
13# The above copyright notice and this permission notice shall be
14# included in all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24$schema: http://json-schema.org/draft-07/schema#
c3fa1a14 25$id: https://barectf.org/schemas/config/3/field-type.json
4810b707
PP
26title: Effective field type object
27definitions:
28 ft-base:
29 type: object
30 required:
31 - class
32 bit-array-ft:
33 allOf:
34 - $ref: '#/definitions/ft-base'
35 - properties:
36 size:
c3fa1a14 37 $ref: https://barectf.org/schemas/config/common/common.json#/definitions/int-ft-size-prop
4810b707 38 alignment:
c3fa1a14 39 $ref: https://barectf.org/schemas/config/common/common.json#/definitions/opt-int-min-1
4810b707
PP
40 required:
41 - size
42 int-ft-props:
43 properties:
44 class: true
45 size: true
46 alignment: true
4810b707
PP
47 preferred-display-base: true
48 additionalProperties: false
49 int-ft:
50 allOf:
51 - $ref: '#/definitions/bit-array-ft'
52 - properties:
53 preferred-display-base:
c3fa1a14 54 $ref: https://barectf.org/schemas/config/common/common.json#/definitions/opt-int-ft-preferred-display-base-prop
4810b707
PP
55 uint-ft-class-prop:
56 type: string
57 enum:
58 - uint
59 - unsigned-int
60 - unsigned-integer
61 uint-ft:
62 title: Unsigned integer field type object
63 allOf:
64 - $ref: '#/definitions/int-ft'
65 - $ref: '#/definitions/int-ft-props'
66 - properties:
67 class:
68 $ref: '#/definitions/uint-ft-class-prop'
69 sint-ft-class-prop:
70 type: string
71 enum:
72 - sint
73 - signed-int
74 - signed-integer
75 sint-ft:
76 title: Signed integer field type object
77 allOf:
78 - $ref: '#/definitions/int-ft'
79 - $ref: '#/definitions/int-ft-props'
80 - properties:
81 class:
82 $ref: '#/definitions/sint-ft-class-prop'
83 enum-ft-props:
84 properties:
85 class: true
86 size: true
87 alignment: true
4810b707
PP
88 preferred-display-base: true
89 mappings: true
90 additionalProperties: false
91 enum-ft:
92 properties:
93 mappings:
94 if:
95 type: object
96 then:
97 patternProperties:
98 '.*':
99 type: array
100 items:
101 if:
102 type: array
103 then:
104 items:
105 type: integer
106 minItems: 2
107 maxItems: 2
108 else:
109 type: integer
110 else:
111 type: 'null'
112 properties:
113 class: true
114 size: true
115 alignment: true
4810b707
PP
116 preferred-display-base: true
117 mappings: true
118 additionalProperties: false
119 uenum-ft-class-prop:
120 type: string
121 enum:
122 - uenum
123 - unsigned-enum
124 - unsigned-enumeration
125 uenum-ft:
126 title: Unsigned enumeration field type object
127 allOf:
128 - $ref: '#/definitions/int-ft'
129 - $ref: '#/definitions/enum-ft'
130 - $ref: '#/definitions/enum-ft-props'
131 - properties:
132 class:
133 $ref: '#/definitions/uenum-ft-class-prop'
134 senum-ft-class-prop:
135 type: string
136 enum:
137 - senum
138 - signed-enum
139 - signed-enumeration
140 senum-ft:
141 title: Signed enumeration field type object
142 allOf:
143 - $ref: '#/definitions/int-ft'
144 - $ref: '#/definitions/enum-ft'
145 - $ref: '#/definitions/enum-ft-props'
146 - properties:
147 class:
148 $ref: '#/definitions/senum-ft-class-prop'
149 real-ft-class-prop:
150 type: string
151 const: real
152 real-ft:
153 title: Real field type object
154 allOf:
155 - $ref: '#/definitions/bit-array-ft'
156 - properties:
157 class:
158 $ref: '#/definitions/real-ft-class-prop'
159 size:
160 enum:
161 - 32
162 - 64
163 properties:
164 class: true
165 size: true
166 alignment: true
4810b707
PP
167 additionalProperties: false
168 string-ft-class-prop:
169 type: string
170 enum:
171 - str
172 - string
173 string-ft:
174 title: String field type object
175 allOf:
176 - $ref: '#/definitions/ft-base'
177 - properties:
178 class:
179 $ref: '#/definitions/string-ft-class-prop'
180 properties:
181 class: true
182 additionalProperties: false
183 static-array-ft-class-prop:
184 type: string
185 const: static-array
186 static-array-ft:
187 title: Static array field type object
188 allOf:
189 - $ref: '#/definitions/ft-base'
190 - properties:
191 class:
192 $ref: '#/definitions/static-array-ft-class-prop'
193 element-field-type:
194 $ref: '#/definitions/ft'
195 length:
196 type: integer
197 minimum: 0
198 required:
199 - element-field-type
200 - length
201 properties:
202 class: true
203 element-field-type: true
204 length: true
205 additionalProperties: false
206 struct-ft-class-prop:
207 type: string
208 enum:
209 - struct
210 - structure
211 struct-ft-member:
212 type: object
213 properties:
214 field-type:
215 $ref: '#/definitions/ft'
216 required:
217 - field-type
218 additionalProperties: false
219 struct-ft-members:
220 type: array
221 items:
222 type: object
223 patternProperties:
224 '^[A-Za-z_][A-Za-z0-9_]*$':
225 $ref: '#/definitions/struct-ft-member'
226 minProperties: 1
227 maxProperties: 1
228 struct-ft:
229 title: Structure field type object
230 allOf:
231 - $ref: '#/definitions/ft-base'
232 - properties:
233 class:
234 $ref: '#/definitions/struct-ft-class-prop'
235 minimum-alignment:
c3fa1a14 236 $ref: https://barectf.org/schemas/config/common/common.json#/definitions/opt-int-min-1
4810b707
PP
237 members:
238 if:
239 type: array
240 then:
241 $ref: '#/definitions/struct-ft-members'
242 else:
243 type: 'null'
244 properties:
245 class: true
246 minimum-alignment: true
247 members: true
248 additionalProperties: false
249 ft:
250 allOf:
251 - $ref: '#/definitions/ft-base'
252 - properties:
253 # This is used to make sure that the field type's class name
254 # is valid as any of the conditionals below can fail.
255 #
256 # Although we could use `oneOf` instead of this enumeration
257 # here and refer to each of the `*-ft-class-prop` definitions,
258 # it would be hard for the validator to show something useful
259 # for the user as all cases would fail.
260 #
261 # Using `enum` below makes the validator show a very clear
262 # validation failure message.
263 class:
264 enum:
265 - uint
266 - unsigned-int
267 - unsigned-integer
268 - sint
269 - signed-int
270 - signed-integer
271 - uenum
272 - unsigned-enum
273 - unsigned-enumeration
274 - senum
275 - signed-enum
276 - signed-enumeration
277 - real
278 - str
279 - string
280 - static-array
281 - struct
282 - structure
283 - if:
284 properties:
285 class:
286 $ref: '#/definitions/uint-ft-class-prop'
287 then:
288 $ref: '#/definitions/uint-ft'
289 - if:
290 properties:
291 class:
292 $ref: '#/definitions/sint-ft-class-prop'
293 then:
294 $ref: '#/definitions/sint-ft'
295 - if:
296 properties:
297 class:
298 $ref: '#/definitions/uenum-ft-class-prop'
299 then:
300 $ref: '#/definitions/uenum-ft'
301 - if:
302 properties:
303 class:
304 $ref: '#/definitions/senum-ft-class-prop'
305 then:
306 $ref: '#/definitions/senum-ft'
307 - if:
308 properties:
309 class:
310 $ref: '#/definitions/real-ft-class-prop'
311 then:
312 $ref: '#/definitions/real-ft'
313 - if:
314 properties:
315 class:
316 $ref: '#/definitions/string-ft-class-prop'
317 then:
318 $ref: '#/definitions/string-ft'
319 - if:
320 properties:
321 class:
322 $ref: '#/definitions/static-array-ft-class-prop'
323 then:
324 $ref: '#/definitions/static-array-ft'
325 - if:
326 properties:
327 class:
328 $ref: '#/definitions/struct-ft-class-prop'
329 then:
330 $ref: '#/definitions/struct-ft'
331 required:
332 - class
333$ref: '#/definitions/ft'
This page took 0.03546 seconds and 4 git commands to generate.