Use JSON schemas to validate the layout and types of the YAML config.
[barectf.git] / barectf / schemas / 2 / config / config.yaml
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#
25 $id: https://barectf.org/schemas/2/config/config.json
26 title: Effective configuration object
27 definitions:
28 opt-bool:
29 oneOf:
30 - type: boolean
31 - type: 'null'
32 opt-string:
33 oneOf:
34 - type: string
35 - type: 'null'
36 opt-int-min-0:
37 oneOf:
38 - type: integer
39 minimum: 0
40 - type: 'null'
41 opt-field-type:
42 oneOf:
43 - $ref: https://barectf.org/schemas/2/config/field-type.json
44 - type: 'null'
45 opt-struct-field-type:
46 oneOf:
47 - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/struct-field-type
48 - type: 'null'
49 trace:
50 title: Trace object
51 type: object
52 properties:
53 byte-order:
54 $ref: https://barectf.org/schemas/2/config/byte-order-prop.json
55 uuid:
56 oneOf:
57 - $ref: https://barectf.org/schemas/2/config/uuid-prop.json
58 - type: string
59 const: auto
60 - type: 'null'
61 packet-header-type:
62 $ref: '#/definitions/opt-struct-field-type'
63 required:
64 - byte-order
65 additionalProperties: false
66 clock:
67 title: Clock object
68 type: object
69 oneOf:
70 - required:
71 - $return-ctype
72 - required:
73 - return-ctype
74 - allOf:
75 - not:
76 required:
77 - $return-ctype
78 - not:
79 required:
80 - return-ctype
81 properties:
82 uuid:
83 oneOf:
84 - $ref: https://barectf.org/schemas/2/config/uuid-prop.json
85 - type: 'null'
86 description:
87 $ref: '#/definitions/opt-string'
88 freq:
89 oneOf:
90 - type: integer
91 minimum: 1
92 - type: 'null'
93 error-cycles:
94 $ref: '#/definitions/opt-int-min-0'
95 offset:
96 oneOf:
97 - type: object
98 properties:
99 cycles:
100 $ref: '#/definitions/opt-int-min-0'
101 seconds:
102 $ref: '#/definitions/opt-int-min-0'
103 additionalProperties: false
104 - type: 'null'
105 absolute:
106 $ref: '#/definitions/opt-bool'
107 return-ctype:
108 $ref: '#/definitions/opt-string'
109 $return-ctype:
110 $ref: '#/definitions/opt-string'
111 additionalProperties: false
112 $default-stream:
113 oneOf:
114 - type: string
115 pattern: '^[A-Za-z_][A-Za-z0-9_]*$'
116 - type: 'null'
117 stream:
118 title: Stream object
119 type: object
120 properties:
121 $default:
122 $ref: '#/definitions/opt-bool'
123 packet-context-type:
124 $ref: '#/definitions/opt-struct-field-type'
125 event-header-type:
126 $ref: '#/definitions/opt-struct-field-type'
127 event-context-type:
128 $ref: '#/definitions/opt-struct-field-type'
129 events:
130 title: Events object
131 type: object
132 patternProperties:
133 '^[A-Za-z_][A-Za-z0-9_]*$':
134 $ref: '#/definitions/event'
135 additionalProperties: false
136 minProperties: 1
137 required:
138 - events
139 additionalProperties: false
140 event:
141 title: Event object
142 type: object
143 properties:
144 log-level:
145 $ref: '#/definitions/opt-int-min-0'
146 context-type:
147 $ref: '#/definitions/opt-struct-field-type'
148 payload-type:
149 $ref: '#/definitions/opt-struct-field-type'
150 additionalProperties: false
151 type: object
152 properties:
153 version:
154 type: string
155 enum:
156 - '2.0'
157 - '2.1'
158 - '2.2'
159 prefix:
160 type: string
161 allOf:
162 - pattern: '^[A-Za-z_][A-Za-z0-9_]*$'
163 - not:
164 enum:
165 - align
166 - callsite
167 - clock
168 - enum
169 - env
170 - event
171 - floating_point
172 - integer
173 - stream
174 - string
175 - struct
176 - trace
177 - typealias
178 - typedef
179 - variant
180 options:
181 title: Configuration options object
182 type: object
183 properties:
184 gen-prefix-def:
185 type: boolean
186 gen-default-stream-def:
187 type: boolean
188 additionalProperties: false
189 metadata:
190 title: Metadata object
191 type: object
192 properties:
193 trace:
194 $ref: '#/definitions/trace'
195 env:
196 title: Environment variables
197 oneOf:
198 - type: object
199 patternProperties:
200 '^[A-Za-z_][A-Za-z0-9_]*$':
201 oneOf:
202 - type: string
203 - type: integer
204 additionalProperties: false
205 - type: 'null'
206 clocks:
207 title: Clocks object
208 type: object
209 patternProperties:
210 '^[A-Za-z_][A-Za-z0-9_]*$':
211 $ref: '#/definitions/clock'
212 additionalProperties: false
213 $default-stream:
214 $ref: '#/definitions/opt-string'
215 streams:
216 title: Streams object
217 type: object
218 patternProperties:
219 '^[A-Za-z_][A-Za-z0-9_]*$':
220 $ref: '#/definitions/stream'
221 additionalProperties: false
222 minProperties: 1
223 required:
224 - trace
225 - streams
226 additionalProperties: false
227 required:
228 - version
229 - metadata
230 additionalProperties: false
This page took 0.043299 seconds and 4 git commands to generate.