forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson_schema.cpp
470 lines (415 loc) · 29.8 KB
/
json_schema.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
#include "nmos/json_schema.h"
#include "cpprest/basic_utils.h"
#include "nmos/is04_versions.h"
#include "nmos/is04_schemas/is04_schemas.h"
#include "nmos/is05_versions.h"
#include "nmos/is05_schemas/is05_schemas.h"
#include "nmos/is08_versions.h"
#include "nmos/is08_schemas/is08_schemas.h"
#include "nmos/is09_versions.h"
#include "nmos/is09_schemas/is09_schemas.h"
#include "nmos/is10_schemas/is10_schemas.h"
#include "nmos/type.h"
namespace nmos
{
namespace is04_schemas
{
web::uri make_schema_uri(const utility::string_t& tag, const utility::string_t& ref = {})
{
return{ _XPLATSTR("https://github.com/AMWA-TV/is-04/raw/") + tag + _XPLATSTR("/APIs/schemas/") + ref };
}
// See https://github.com/AMWA-TV/is-04/blob/v1.3.x/APIs/schemas/
namespace v1_3
{
using namespace nmos::is04_schemas::v1_3_x;
const utility::string_t tag(_XPLATSTR("v1.3.x"));
const web::uri registrationapi_resource_post_request_uri = make_schema_uri(tag, _XPLATSTR("registrationapi-resource-post-request.json"));
const web::uri queryapi_subscriptions_post_request_uri = make_schema_uri(tag, _XPLATSTR("queryapi-subscriptions-post-request.json"));
const web::uri nodeapi_receiver_target_put_request_uri = make_schema_uri(tag, _XPLATSTR("nodeapi-receiver-target.json"));
}
// See https://github.com/AMWA-TV/is-04/blob/v1.2.x/APIs/schemas/
namespace v1_2
{
using namespace nmos::is04_schemas::v1_2_x;
const utility::string_t tag(_XPLATSTR("v1.2.x"));
const web::uri registrationapi_resource_post_request_uri = make_schema_uri(tag, _XPLATSTR("registrationapi-resource-post-request.json"));
const web::uri queryapi_subscriptions_post_request_uri = make_schema_uri(tag, _XPLATSTR("queryapi-subscriptions-post-request.json"));
const web::uri nodeapi_receiver_target_put_request_uri = make_schema_uri(tag, _XPLATSTR("nodeapi-receiver-target.json"));
}
// See https://github.com/AMWA-TV/is-04/blob/v1.1.x/APIs/schemas/
namespace v1_1
{
using namespace nmos::is04_schemas::v1_1_x;
const utility::string_t tag(_XPLATSTR("v1.1.x"));
const web::uri registrationapi_resource_post_request_uri = make_schema_uri(tag, _XPLATSTR("registrationapi-resource-post-request.json"));
const web::uri queryapi_subscriptions_post_request_uri = make_schema_uri(tag, _XPLATSTR("queryapi-subscriptions-post-request.json"));
const web::uri nodeapi_receiver_target_put_request_uri = make_schema_uri(tag, _XPLATSTR("nodeapi-receiver-target.json"));
}
// See https://github.com/AMWA-TV/is-04/blob/v1.0.x/APIs/schemas/
namespace v1_0
{
using namespace nmos::is04_schemas::v1_0_x;
const utility::string_t tag(_XPLATSTR("v1.0.x"));
const web::uri registrationapi_resource_post_request_uri = make_schema_uri(tag, _XPLATSTR("registrationapi-v1.0-resource-post-request.json"));
const web::uri queryapi_subscriptions_post_request_uri = make_schema_uri(tag, _XPLATSTR("queryapi-v1.0-subscriptions-post-request.json"));
const web::uri nodeapi_receiver_target_put_request_uri = make_schema_uri(tag, _XPLATSTR("nodeapi-receiver-target.json"));
}
}
namespace is05_schemas
{
web::uri make_schema_uri(const utility::string_t& tag, const utility::string_t& ref = {})
{
return{ _XPLATSTR("https://github.com/AMWA-TV/is-05/raw/") + tag + _XPLATSTR("/APIs/schemas/") + ref };
}
// See https://github.com/AMWA-TV/is-05/blob/v1.1.x/APIs/schemas/
namespace v1_1
{
using namespace nmos::is05_schemas::v1_1_x;
const utility::string_t tag(_XPLATSTR("v1.1.x"));
const web::uri connectionapi_sender_staged_patch_request_uri = make_schema_uri(tag, _XPLATSTR("sender-stage-schema.json"));
const web::uri connectionapi_receiver_staged_patch_request_uri = make_schema_uri(tag, _XPLATSTR("receiver-stage-schema.json"));
}
// See https://github.com/AMWA-TV/is-05/blob/v1.0.x/APIs/schemas/
namespace v1_0
{
using namespace nmos::is05_schemas::v1_0_x;
const utility::string_t tag(_XPLATSTR("v1.0.x"));
const web::uri connectionapi_sender_staged_patch_request_uri = make_schema_uri(tag, _XPLATSTR("v1.0-sender-stage-schema.json"));
const web::uri connectionapi_receiver_staged_patch_request_uri = make_schema_uri(tag, _XPLATSTR("v1.0-receiver-stage-schema.json"));
}
}
namespace is08_schemas
{
web::uri make_schema_uri(const utility::string_t& tag, const utility::string_t& ref = {})
{
return{ _XPLATSTR("https://github.com/AMWA-TV/is-08/raw/") + tag + _XPLATSTR("/APIs/schemas/") + ref };
}
// See https://github.com/AMWA-TV/is-08/blob/v1.0.x/APIs/schemas/
namespace v1_0
{
using namespace nmos::is08_schemas::v1_0_x;
const utility::string_t tag(_XPLATSTR("v1.0.x"));
const web::uri map_activations_post_request_uri = make_schema_uri(tag, _XPLATSTR("map-activations-post-request-schema.json"));
}
}
namespace is09_schemas
{
web::uri make_schema_uri(const utility::string_t& tag, const utility::string_t& ref = {})
{
return{ _XPLATSTR("https://github.com/AMWA-TV/is-09/raw/") + tag + _XPLATSTR("/APIs/schemas/") + ref };
}
// See https://github.com/AMWA-TV/is-09/blob/v1.0.x/APIs/schemas/
namespace v1_0
{
using namespace nmos::is09_schemas::v1_0_x;
const utility::string_t tag(_XPLATSTR("v1.0.x"));
const web::uri systemapi_global_schema_uri = make_schema_uri(tag, _XPLATSTR("global.json"));
}
}
namespace is10_schemas
{
web::uri make_schema_uri(const utility::string_t& tag, const utility::string_t& ref = {})
{
return{ _XPLATSTR("https://github.com/AMWA-TV/nmos-authorization/raw/") + tag + _XPLATSTR("/APIs/schemas/") + ref };
}
namespace v1_0
{
using namespace nmos::is10_schemas::v1_0_x;
const utility::string_t tag(_XPLATSTR("v1.0.x"));
const web::uri authapi_auth_metadata_schema_uri = make_schema_uri(tag, _XPLATSTR("auth_metadata.json"));
const web::uri authapi_jwks_response_schema_uri = make_schema_uri(tag, _XPLATSTR("jwks_response.json"));
const web::uri authapi_register_client_error_response_uri = make_schema_uri(tag, _XPLATSTR("register_client_error_response.json"));
const web::uri authapi_register_client_response_uri = make_schema_uri(tag, _XPLATSTR("register_client_response.json"));
const web::uri authapi_token_error_response_uri = make_schema_uri(tag, _XPLATSTR("token_error_response.json"));
const web::uri authapi_token_response_schema_uri = make_schema_uri(tag, _XPLATSTR("token_response.json"));
const web::uri authapi_token_schema_schema_uri = make_schema_uri(tag, _XPLATSTR("token_schema.json"));
}
}
}
namespace nmos
{
namespace details
{
static web::json::value make_schema(const char* schema)
{
return web::json::value::parse(utility::s2us(schema));
}
static std::map<web::uri, web::json::value> make_is04_schemas()
{
using namespace nmos::is04_schemas;
return
{
// v1.3
{ make_schema_uri(v1_3::tag, _XPLATSTR("registrationapi-resource-post-request.json")), make_schema(v1_3::registrationapi_resource_post_request) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("clock_internal.json")), make_schema(v1_3::clock_internal) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("clock_ptp.json")), make_schema(v1_3::clock_ptp) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("resource_core.json")), make_schema(v1_3::resource_core) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("device.json")), make_schema(v1_3::device) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow.json")), make_schema(v1_3::flow) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_video_raw.json")), make_schema(v1_3::flow_video_raw) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_video_coded.json")), make_schema(v1_3::flow_video_coded) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_audio_raw.json")), make_schema(v1_3::flow_audio_raw) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_audio_coded.json")), make_schema(v1_3::flow_audio_coded) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_data.json")), make_schema(v1_3::flow_data) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_json_data.json")), make_schema(v1_3::flow_json_data) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_sdianc_data.json")), make_schema(v1_3::flow_sdianc_data) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_mux.json")), make_schema(v1_3::flow_mux) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_audio.json")), make_schema(v1_3::flow_audio) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_core.json")), make_schema(v1_3::flow_core) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("flow_video.json")), make_schema(v1_3::flow_video) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("node.json")), make_schema(v1_3::node) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver.json")), make_schema(v1_3::receiver) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver_video.json")), make_schema(v1_3::receiver_video) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver_audio.json")), make_schema(v1_3::receiver_audio) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver_data.json")), make_schema(v1_3::receiver_data) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver_mux.json")), make_schema(v1_3::receiver_mux) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("receiver_core.json")), make_schema(v1_3::receiver_core) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("sender.json")), make_schema(v1_3::sender) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("source.json")), make_schema(v1_3::source) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("source_generic.json")), make_schema(v1_3::source_generic) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("source_audio.json")), make_schema(v1_3::source_audio) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("source_core.json")), make_schema(v1_3::source_core) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("source_data.json")), make_schema(v1_3::source_data) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("queryapi-subscriptions-post-request.json")), make_schema(v1_3::queryapi_subscriptions_post_request) },
{ make_schema_uri(v1_3::tag, _XPLATSTR("nodeapi-receiver-target.json")), make_schema(v1_3::nodeapi_receiver_target) },
// v1.2
{ make_schema_uri(v1_2::tag, _XPLATSTR("registrationapi-resource-post-request.json")), make_schema(v1_2::registrationapi_resource_post_request) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("clock_internal.json")), make_schema(v1_2::clock_internal) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("clock_ptp.json")), make_schema(v1_2::clock_ptp) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("resource_core.json")), make_schema(v1_2::resource_core) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("device.json")), make_schema(v1_2::device) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow.json")), make_schema(v1_2::flow) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_video_raw.json")), make_schema(v1_2::flow_video_raw) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_video_coded.json")), make_schema(v1_2::flow_video_coded) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_audio_raw.json")), make_schema(v1_2::flow_audio_raw) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_audio_coded.json")), make_schema(v1_2::flow_audio_coded) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_data.json")), make_schema(v1_2::flow_data) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_sdianc_data.json")), make_schema(v1_2::flow_sdianc_data) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_mux.json")), make_schema(v1_2::flow_mux) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_audio.json")), make_schema(v1_2::flow_audio) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_core.json")), make_schema(v1_2::flow_core) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("flow_video.json")), make_schema(v1_2::flow_video) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("node.json")), make_schema(v1_2::node) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver.json")), make_schema(v1_2::receiver) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver_video.json")), make_schema(v1_2::receiver_video) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver_audio.json")), make_schema(v1_2::receiver_audio) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver_data.json")), make_schema(v1_2::receiver_data) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver_mux.json")), make_schema(v1_2::receiver_mux) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("receiver_core.json")), make_schema(v1_2::receiver_core) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("sender.json")), make_schema(v1_2::sender) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("source.json")), make_schema(v1_2::source) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("source_generic.json")), make_schema(v1_2::source_generic) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("source_audio.json")), make_schema(v1_2::source_audio) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("source_core.json")), make_schema(v1_2::source_core) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("queryapi-subscriptions-post-request.json")), make_schema(v1_2::queryapi_subscriptions_post_request) },
{ make_schema_uri(v1_2::tag, _XPLATSTR("nodeapi-receiver-target.json")), make_schema(v1_2::nodeapi_receiver_target) },
// v1.1
{ make_schema_uri(v1_1::tag, _XPLATSTR("registrationapi-resource-post-request.json")), make_schema(v1_1::registrationapi_resource_post_request) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("clock_internal.json")), make_schema(v1_1::clock_internal) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("clock_ptp.json")), make_schema(v1_1::clock_ptp) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("resource_core.json")), make_schema(v1_1::resource_core) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("device.json")), make_schema(v1_1::device) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow.json")), make_schema(v1_1::flow) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_video_raw.json")), make_schema(v1_1::flow_video_raw) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_video_coded.json")), make_schema(v1_1::flow_video_coded) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_audio_raw.json")), make_schema(v1_1::flow_audio_raw) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_audio_coded.json")), make_schema(v1_1::flow_audio_coded) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_data.json")), make_schema(v1_1::flow_data) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_sdianc_data.json")), make_schema(v1_1::flow_sdianc_data) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_mux.json")), make_schema(v1_1::flow_mux) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_audio.json")), make_schema(v1_1::flow_audio) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_core.json")), make_schema(v1_1::flow_core) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("flow_video.json")), make_schema(v1_1::flow_video) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("node.json")), make_schema(v1_1::node) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver.json")), make_schema(v1_1::receiver) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_video.json")), make_schema(v1_1::receiver_video) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_audio.json")), make_schema(v1_1::receiver_audio) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_data.json")), make_schema(v1_1::receiver_data) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_mux.json")), make_schema(v1_1::receiver_mux) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_core.json")), make_schema(v1_1::receiver_core) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender.json")), make_schema(v1_1::sender) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("source.json")), make_schema(v1_1::source) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("source_generic.json")), make_schema(v1_1::source_generic) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("source_audio.json")), make_schema(v1_1::source_audio) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("source_core.json")), make_schema(v1_1::source_core) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("queryapi-subscriptions-post-request.json")), make_schema(v1_1::queryapi_subscriptions_post_request) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("nodeapi-receiver-target.json")), make_schema(v1_1::nodeapi_receiver_target) },
// v1.0
{ make_schema_uri(v1_0::tag, _XPLATSTR("registrationapi-v1.0-resource-post-request.json")), make_schema(v1_0::registrationapi_v1_0_resource_post_request) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("device.json")), make_schema(v1_0::device) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("flow.json")), make_schema(v1_0::flow) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("node.json")), make_schema(v1_0::node) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("receiver.json")), make_schema(v1_0::receiver) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("sender.json")), make_schema(v1_0::sender) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("source.json")), make_schema(v1_0::source) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("queryapi-v1.0-subscriptions-post-request.json")), make_schema(v1_0::queryapi_v1_0_subscriptions_post_request) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("nodeapi-receiver-target.json")), make_schema(v1_0::nodeapi_receiver_target) },
};
}
static std::map<web::uri, web::json::value> make_is05_schemas()
{
using namespace nmos::is05_schemas;
return
{
// v1.1
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender-stage-schema.json")), make_schema(v1_1::sender_stage_schema) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver-stage-schema.json")), make_schema(v1_1::receiver_stage_schema) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver-transport-file.json")), make_schema(v1_1::receiver_transport_file) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("activation-schema.json")), make_schema(v1_1::activation_schema) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params.json")), make_schema(v1_1::sender_transport_params) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params_rtp.json")), make_schema(v1_1::sender_transport_params_rtp) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params_dash.json")), make_schema(v1_1::sender_transport_params_dash) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params_websocket.json")), make_schema(v1_1::sender_transport_params_websocket) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params_mqtt.json")), make_schema(v1_1::sender_transport_params_mqtt) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("sender_transport_params_ext.json")), make_schema(v1_1::sender_transport_params_ext) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params.json")), make_schema(v1_1::receiver_transport_params) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params_rtp.json")), make_schema(v1_1::receiver_transport_params_rtp) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params_dash.json")), make_schema(v1_1::receiver_transport_params_dash) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params_websocket.json")), make_schema(v1_1::receiver_transport_params_websocket) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params_mqtt.json")), make_schema(v1_1::receiver_transport_params_mqtt) },
{ make_schema_uri(v1_1::tag, _XPLATSTR("receiver_transport_params_ext.json")), make_schema(v1_1::receiver_transport_params_ext) },
// v1.0
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0-sender-stage-schema.json")), make_schema(v1_0::v1_0_sender_stage_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0-receiver-stage-schema.json")), make_schema(v1_0::v1_0_receiver_stage_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0-activation-schema.json")), make_schema(v1_0::v1_0_activation_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0_sender_transport_params_rtp.json")), make_schema(v1_0::v1_0_sender_transport_params_rtp) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0_sender_transport_params_dash.json")), make_schema(v1_0::v1_0_sender_transport_params_dash) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0_receiver_transport_params_rtp.json")), make_schema(v1_0::v1_0_receiver_transport_params_rtp) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("v1.0_receiver_transport_params_dash.json")), make_schema(v1_0::v1_0_receiver_transport_params_dash) }
};
}
static std::map<web::uri, web::json::value> make_is08_schemas()
{
using namespace nmos::is08_schemas;
return
{
// v1.0
{ make_schema_uri(v1_0::tag, _XPLATSTR("activation-schema.json")), make_schema(v1_0::activation_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("map-activations-post-request-schema.json")), make_schema(v1_0::map_activations_post_request_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("map-entries-schema.json")), make_schema(v1_0::map_entries_schema) },
};
}
static std::map<web::uri, web::json::value> make_is09_schemas()
{
using namespace nmos::is09_schemas;
return
{
// v1.0
{ make_schema_uri(v1_0::tag, _XPLATSTR("global.json")), make_schema(v1_0::global) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("resource_core.json")), make_schema(v1_0::resource_core) }
};
}
static std::map<web::uri, web::json::value> make_is10_schemas()
{
using namespace nmos::is10_schemas;
return
{
// v1.0
{ make_schema_uri(v1_0::tag, _XPLATSTR("auth_metadata.json")), make_schema(v1_0::auth_metadata) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("jwks_response.json")), make_schema(v1_0::jwks_response) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("jwks_schema.json")), make_schema(v1_0::jwks_schema) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("register_client_error_response.json")), make_schema(v1_0::register_client_error_response) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("register_client_response.json")), make_schema(v1_0::register_client_response) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("token_error_response.json")), make_schema(v1_0::token_error_response) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("token_response.json")), make_schema(v1_0::token_response) },
{ make_schema_uri(v1_0::tag, _XPLATSTR("token_schema.json")), make_schema(v1_0::token_schema) }
};
}
inline void merge(std::map<web::uri, web::json::value>& to, std::map<web::uri, web::json::value>&& from)
{
to.insert(from.begin(), from.end()); // std::map::merge in C++17
}
std::map<web::uri, web::json::value> make_schemas()
{
auto result = make_is04_schemas();
merge(result, make_is05_schemas());
merge(result, make_is08_schemas());
merge(result, make_is09_schemas());
merge(result, make_is10_schemas());
return result;
}
static std::map<web::uri, web::json::value> schemas = make_schemas();
}
namespace experimental
{
web::uri make_systemapi_global_schema_uri(const nmos::api_version& version)
{
return is09_schemas::v1_0::systemapi_global_schema_uri;
}
web::uri make_registrationapi_resource_post_request_schema_uri(const nmos::api_version& version)
{
if (is04_versions::v1_3 <= version) return is04_schemas::v1_3::registrationapi_resource_post_request_uri;
if (is04_versions::v1_2 <= version) return is04_schemas::v1_2::registrationapi_resource_post_request_uri;
if (is04_versions::v1_1 <= version) return is04_schemas::v1_1::registrationapi_resource_post_request_uri;
return is04_schemas::v1_0::registrationapi_resource_post_request_uri;
}
web::uri make_queryapi_subscriptions_post_request_schema_uri(const nmos::api_version& version)
{
if (is04_versions::v1_3 <= version) return is04_schemas::v1_3::queryapi_subscriptions_post_request_uri;
if (is04_versions::v1_2 <= version) return is04_schemas::v1_2::queryapi_subscriptions_post_request_uri;
if (is04_versions::v1_1 <= version) return is04_schemas::v1_1::queryapi_subscriptions_post_request_uri;
return is04_schemas::v1_0::queryapi_subscriptions_post_request_uri;
}
web::uri make_nodeapi_receiver_target_put_request_schema_uri(const nmos::api_version& version)
{
if (is04_versions::v1_3 <= version) return is04_schemas::v1_3::nodeapi_receiver_target_put_request_uri;
if (is04_versions::v1_2 <= version) return is04_schemas::v1_2::nodeapi_receiver_target_put_request_uri;
if (is04_versions::v1_1 <= version) return is04_schemas::v1_1::nodeapi_receiver_target_put_request_uri;
return is04_schemas::v1_0::nodeapi_receiver_target_put_request_uri;
}
web::uri make_connectionapi_staged_patch_request_schema_uri(const nmos::api_version& version, const nmos::type& type)
{
return nmos::types::sender == type
? make_connectionapi_sender_staged_patch_request_schema_uri(version)
: make_connectionapi_receiver_staged_patch_request_schema_uri(version);
}
web::uri make_connectionapi_sender_staged_patch_request_schema_uri(const nmos::api_version& version)
{
if (is05_versions::v1_1 <= version) return is05_schemas::v1_1::connectionapi_sender_staged_patch_request_uri;
return is05_schemas::v1_0::connectionapi_sender_staged_patch_request_uri;
}
web::uri make_connectionapi_receiver_staged_patch_request_schema_uri(const nmos::api_version& version)
{
if (is05_versions::v1_1 <= version) return is05_schemas::v1_1::connectionapi_receiver_staged_patch_request_uri;
return is05_schemas::v1_0::connectionapi_receiver_staged_patch_request_uri;
}
web::uri make_channelmappingapi_map_activations_post_request_schema_uri(const nmos::api_version& version)
{
return is08_schemas::v1_0::map_activations_post_request_uri;
}
web::uri make_authapi_auth_metadata_schema_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_auth_metadata_schema_uri;
}
web::uri make_authapi_jwks_response_schema_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_jwks_response_schema_uri;
}
web::uri make_authapi_register_client_response_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_register_client_response_uri;
}
web::uri make_authapi_token_error_response_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_token_error_response_uri;
}
web::uri make_authapi_token_schema_schema_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_token_schema_schema_uri;
}
web::uri make_authapi_token_response_schema_uri(const nmos::api_version& version)
{
return is10_schemas::v1_0::authapi_token_response_schema_uri;
}
// load the json schema for the specified base URI
web::json::value load_json_schema(const web::uri& id)
{
auto found = nmos::details::schemas.find(id);
if (nmos::details::schemas.end() == found)
{
throw web::json::json_exception((_XPLATSTR("schema not found for ") + id.to_string()).c_str());
}
return found->second;
}
}
}