@rosen-bridge/config 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +69 -85
- package/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +51 -49
- package/dist/index.d.ts +1 -1
- package/dist/schema/Validators/fieldProperties.d.ts +1 -0
- package/dist/schema/Validators/fieldProperties.d.ts.map +1 -1
- package/dist/schema/Validators/fieldProperties.js +61 -2
- package/dist/schema/types/fields.d.ts +1 -0
- package/dist/schema/types/fields.d.ts.map +1 -1
- package/dist/schema/types/fields.js +1 -1
- package/dist/schema/types/validations.d.ts +14 -24
- package/dist/utils.d.ts +5 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +29 -27
- package/dist/value/validators.d.ts +1 -1
- package/dist/value/validators.js +1 -1
- package/lib/config.ts +55 -64
- package/lib/schema/Validators/fieldProperties.ts +75 -1
- package/lib/schema/types/fields.ts +1 -0
- package/package.json +10 -13
- package/tests/config.spec.ts +415 -7
- package/tests/configTestData.ts +524 -5
- package/tsconfig.build.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +9 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
package/tests/configTestData.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash-es';
|
|
2
|
-
|
|
3
2
|
export const apiSchemaDefaultValuePairSample = {
|
|
4
3
|
schema: {
|
|
5
4
|
apiType: {
|
|
@@ -961,6 +960,7 @@ export const apiSchemaConfigPairWithStringBigInt = {
|
|
|
961
960
|
children: {
|
|
962
961
|
port: {
|
|
963
962
|
type: 'bigint',
|
|
963
|
+
default: '5372',
|
|
964
964
|
},
|
|
965
965
|
},
|
|
966
966
|
},
|
|
@@ -1091,7 +1091,7 @@ export const schemaTypeScriptTypesPair = {
|
|
|
1091
1091
|
types: `export interface Infrastructure {
|
|
1092
1092
|
apis: Apis;
|
|
1093
1093
|
server: Server;
|
|
1094
|
-
explorer:
|
|
1094
|
+
explorer: Explorer;
|
|
1095
1095
|
logs: Logs[];
|
|
1096
1096
|
apiType?: 'node' | 'explorer' | 'superApi';
|
|
1097
1097
|
}
|
|
@@ -1104,7 +1104,7 @@ export interface Logs {
|
|
|
1104
1104
|
level?: string;
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
|
-
export interface
|
|
1107
|
+
export interface Explorer {
|
|
1108
1108
|
domain?: string;
|
|
1109
1109
|
path?: string;
|
|
1110
1110
|
}
|
|
@@ -1115,10 +1115,10 @@ export interface Server {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
1117
|
export interface Apis {
|
|
1118
|
-
explorer:
|
|
1118
|
+
explorer: ApisExplorer;
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
export interface
|
|
1121
|
+
export interface ApisExplorer {
|
|
1122
1122
|
url?: string;
|
|
1123
1123
|
port?: number;
|
|
1124
1124
|
}
|
|
@@ -1214,3 +1214,522 @@ export const schemaConfigCharPair = {
|
|
|
1214
1214
|
},
|
|
1215
1215
|
},
|
|
1216
1216
|
};
|
|
1217
|
+
|
|
1218
|
+
// logs array schema with item-level defaults and array default elements
|
|
1219
|
+
export const logsArraySchemaDefaultsPair = {
|
|
1220
|
+
schema: {
|
|
1221
|
+
logs: {
|
|
1222
|
+
type: 'array',
|
|
1223
|
+
items: {
|
|
1224
|
+
type: 'object',
|
|
1225
|
+
children: {
|
|
1226
|
+
type: {
|
|
1227
|
+
type: 'string',
|
|
1228
|
+
validations: [
|
|
1229
|
+
{
|
|
1230
|
+
required: true,
|
|
1231
|
+
error: 'log type must be specified',
|
|
1232
|
+
},
|
|
1233
|
+
{ choices: ['file', 'console', 'loki'] },
|
|
1234
|
+
],
|
|
1235
|
+
},
|
|
1236
|
+
maxSize: {
|
|
1237
|
+
type: 'string',
|
|
1238
|
+
validations: [
|
|
1239
|
+
{
|
|
1240
|
+
required: true,
|
|
1241
|
+
error: 'maxSize for file log type must be specified',
|
|
1242
|
+
when: { path: 'logs.type', value: 'file' },
|
|
1243
|
+
},
|
|
1244
|
+
],
|
|
1245
|
+
},
|
|
1246
|
+
maxFiles: {
|
|
1247
|
+
type: 'string',
|
|
1248
|
+
validations: [
|
|
1249
|
+
{
|
|
1250
|
+
required: true,
|
|
1251
|
+
error: 'maxFiles for file log type must be specified',
|
|
1252
|
+
when: { path: 'logs.type', value: 'file' },
|
|
1253
|
+
},
|
|
1254
|
+
],
|
|
1255
|
+
},
|
|
1256
|
+
path: {
|
|
1257
|
+
type: 'string',
|
|
1258
|
+
default: '/var/log/app.log',
|
|
1259
|
+
validations: [
|
|
1260
|
+
{
|
|
1261
|
+
required: true,
|
|
1262
|
+
error: 'path for file log type must be specified',
|
|
1263
|
+
when: { path: 'logs.type', value: 'file' },
|
|
1264
|
+
},
|
|
1265
|
+
],
|
|
1266
|
+
},
|
|
1267
|
+
level: {
|
|
1268
|
+
type: 'string',
|
|
1269
|
+
default: 'info',
|
|
1270
|
+
validations: [
|
|
1271
|
+
{
|
|
1272
|
+
required: true,
|
|
1273
|
+
error: 'log level must be specified',
|
|
1274
|
+
when: { path: 'logs.type', value: 'file' },
|
|
1275
|
+
},
|
|
1276
|
+
],
|
|
1277
|
+
},
|
|
1278
|
+
},
|
|
1279
|
+
},
|
|
1280
|
+
default: [{ type: 'file', level: 'debug' }, { type: 'console' }],
|
|
1281
|
+
},
|
|
1282
|
+
},
|
|
1283
|
+
defaultVal: {
|
|
1284
|
+
logs: [
|
|
1285
|
+
{ type: 'file', level: 'debug', path: '/var/log/app.log' },
|
|
1286
|
+
{ type: 'console', level: 'info', path: '/var/log/app.log' },
|
|
1287
|
+
],
|
|
1288
|
+
},
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
// empty array defaults for primitive types
|
|
1292
|
+
export const emptyArrayDefaultsPair = {
|
|
1293
|
+
schema: {
|
|
1294
|
+
emptyStringArray: {
|
|
1295
|
+
type: 'array' as const,
|
|
1296
|
+
default: [],
|
|
1297
|
+
items: { type: 'string' as const },
|
|
1298
|
+
},
|
|
1299
|
+
emptyNumberArray: {
|
|
1300
|
+
type: 'array' as const,
|
|
1301
|
+
default: [],
|
|
1302
|
+
items: { type: 'number' as const },
|
|
1303
|
+
},
|
|
1304
|
+
},
|
|
1305
|
+
defaultVal: {
|
|
1306
|
+
emptyStringArray: [],
|
|
1307
|
+
emptyNumberArray: [],
|
|
1308
|
+
},
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
// schema including an array without default to be excluded from defaults result
|
|
1312
|
+
export const arrayWithoutDefaultPair = {
|
|
1313
|
+
schema: {
|
|
1314
|
+
withDefault: {
|
|
1315
|
+
type: 'string' as const,
|
|
1316
|
+
default: 'test',
|
|
1317
|
+
},
|
|
1318
|
+
arrayWithoutDefault: {
|
|
1319
|
+
type: 'array' as const,
|
|
1320
|
+
items: { type: 'string' as const },
|
|
1321
|
+
},
|
|
1322
|
+
},
|
|
1323
|
+
defaultVal: {
|
|
1324
|
+
withDefault: 'test',
|
|
1325
|
+
},
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
// logs array with invalid defaults (choices violation, missing required) plus expected generated defaults
|
|
1329
|
+
export const invalidLogsArrayDefaultsPair = {
|
|
1330
|
+
schema: {
|
|
1331
|
+
logs: {
|
|
1332
|
+
type: 'array',
|
|
1333
|
+
items: {
|
|
1334
|
+
type: 'object',
|
|
1335
|
+
children: {
|
|
1336
|
+
type: {
|
|
1337
|
+
type: 'string',
|
|
1338
|
+
validations: [
|
|
1339
|
+
{ required: true, error: 'log type must be specified' },
|
|
1340
|
+
{ choices: ['file', 'console', 'loki'] },
|
|
1341
|
+
],
|
|
1342
|
+
},
|
|
1343
|
+
path: { type: 'string', default: '/var/log/app.log' },
|
|
1344
|
+
level: { type: 'string', default: 'info' },
|
|
1345
|
+
},
|
|
1346
|
+
},
|
|
1347
|
+
default: [{ type: 'unknown' as any }, { level: 'debug' }],
|
|
1348
|
+
},
|
|
1349
|
+
},
|
|
1350
|
+
defaultVal: {
|
|
1351
|
+
logs: [
|
|
1352
|
+
{ type: 'unknown', path: '/var/log/app.log', level: 'info' },
|
|
1353
|
+
{ level: 'debug', path: '/var/log/app.log' },
|
|
1354
|
+
],
|
|
1355
|
+
},
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
// logs array with unknown key inside defaults, plus expected generated defaults
|
|
1359
|
+
export const unknownKeyLogsArrayDefaultsPair = {
|
|
1360
|
+
schema: {
|
|
1361
|
+
logs: {
|
|
1362
|
+
type: 'array',
|
|
1363
|
+
items: {
|
|
1364
|
+
type: 'object',
|
|
1365
|
+
children: {
|
|
1366
|
+
path: { type: 'string', default: '/var/log/app.log' },
|
|
1367
|
+
level: { type: 'string', default: 'info' },
|
|
1368
|
+
},
|
|
1369
|
+
},
|
|
1370
|
+
default: [{ pathsskddkfjd: '/tmp/weird' } as any],
|
|
1371
|
+
},
|
|
1372
|
+
},
|
|
1373
|
+
defaultVal: {
|
|
1374
|
+
logs: [
|
|
1375
|
+
{ path: '/var/log/app.log', level: 'info', pathsskddkfjd: '/tmp/weird' },
|
|
1376
|
+
],
|
|
1377
|
+
},
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
// Schemas for duplicate key/type generation tests
|
|
1381
|
+
export const duplicateChildKeysSchema = {
|
|
1382
|
+
schema: {
|
|
1383
|
+
user: {
|
|
1384
|
+
type: 'object',
|
|
1385
|
+
children: {
|
|
1386
|
+
database: {
|
|
1387
|
+
type: 'object',
|
|
1388
|
+
children: {
|
|
1389
|
+
host: { type: 'string' },
|
|
1390
|
+
port: { type: 'number' },
|
|
1391
|
+
},
|
|
1392
|
+
},
|
|
1393
|
+
},
|
|
1394
|
+
},
|
|
1395
|
+
apis: {
|
|
1396
|
+
type: 'object',
|
|
1397
|
+
children: {
|
|
1398
|
+
explorer: {
|
|
1399
|
+
type: 'object',
|
|
1400
|
+
children: {
|
|
1401
|
+
url: { type: 'string' },
|
|
1402
|
+
port: { type: 'number' },
|
|
1403
|
+
},
|
|
1404
|
+
},
|
|
1405
|
+
},
|
|
1406
|
+
},
|
|
1407
|
+
},
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
export const identicalStructurePathsSchema = {
|
|
1411
|
+
schema: {
|
|
1412
|
+
primary: {
|
|
1413
|
+
type: 'object',
|
|
1414
|
+
children: {
|
|
1415
|
+
connection: {
|
|
1416
|
+
type: 'object',
|
|
1417
|
+
children: {
|
|
1418
|
+
host: { type: 'string' },
|
|
1419
|
+
port: { type: 'number' },
|
|
1420
|
+
ssl: { type: 'boolean' },
|
|
1421
|
+
},
|
|
1422
|
+
},
|
|
1423
|
+
},
|
|
1424
|
+
},
|
|
1425
|
+
backup: {
|
|
1426
|
+
type: 'object',
|
|
1427
|
+
children: {
|
|
1428
|
+
connection: {
|
|
1429
|
+
type: 'object',
|
|
1430
|
+
children: {
|
|
1431
|
+
host: { type: 'string' },
|
|
1432
|
+
port: { type: 'number' },
|
|
1433
|
+
ssl: { type: 'boolean' },
|
|
1434
|
+
},
|
|
1435
|
+
},
|
|
1436
|
+
},
|
|
1437
|
+
},
|
|
1438
|
+
},
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1441
|
+
export const arrayItemsAtRootSchema = {
|
|
1442
|
+
schema: {
|
|
1443
|
+
logs: {
|
|
1444
|
+
type: 'array',
|
|
1445
|
+
items: {
|
|
1446
|
+
type: 'object',
|
|
1447
|
+
children: {
|
|
1448
|
+
message: { type: 'string' },
|
|
1449
|
+
level: { type: 'string' },
|
|
1450
|
+
},
|
|
1451
|
+
},
|
|
1452
|
+
},
|
|
1453
|
+
},
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
// Nested defaults: array of objects where an item key is itself a nested array
|
|
1457
|
+
export const nestedArrayInArrayDefaultsPair = {
|
|
1458
|
+
schema: {
|
|
1459
|
+
logs: {
|
|
1460
|
+
type: 'array',
|
|
1461
|
+
items: {
|
|
1462
|
+
type: 'object',
|
|
1463
|
+
children: {
|
|
1464
|
+
name: { type: 'string', default: 'file' },
|
|
1465
|
+
tags: {
|
|
1466
|
+
type: 'array',
|
|
1467
|
+
items: { type: 'string' },
|
|
1468
|
+
default: ['t1', 't2'],
|
|
1469
|
+
},
|
|
1470
|
+
labels: {
|
|
1471
|
+
type: 'array',
|
|
1472
|
+
items: { type: 'string' },
|
|
1473
|
+
default: ['L1'],
|
|
1474
|
+
},
|
|
1475
|
+
},
|
|
1476
|
+
},
|
|
1477
|
+
default: [{}, { tags: ['custom'], labels: [] }],
|
|
1478
|
+
},
|
|
1479
|
+
},
|
|
1480
|
+
defaultVal: {
|
|
1481
|
+
logs: [
|
|
1482
|
+
{ name: 'file', tags: ['t1', 't2'], labels: ['L1'] },
|
|
1483
|
+
{ name: 'file', tags: ['custom'], labels: [] },
|
|
1484
|
+
],
|
|
1485
|
+
},
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
// Schema for invalid defaults used with generateDefault({ validate: true })
|
|
1489
|
+
export const invalidDefaultsValidateOptionSchema = {
|
|
1490
|
+
schema: {
|
|
1491
|
+
logs: {
|
|
1492
|
+
type: 'array',
|
|
1493
|
+
items: {
|
|
1494
|
+
type: 'object',
|
|
1495
|
+
children: {
|
|
1496
|
+
type: {
|
|
1497
|
+
type: 'string',
|
|
1498
|
+
validations: [
|
|
1499
|
+
{ required: true },
|
|
1500
|
+
{ choices: ['file', 'console', 'loki'] },
|
|
1501
|
+
],
|
|
1502
|
+
},
|
|
1503
|
+
level: { type: 'string', default: 'info' },
|
|
1504
|
+
},
|
|
1505
|
+
},
|
|
1506
|
+
default: [{ type: 'unknown' as any }, { level: 'debug' }],
|
|
1507
|
+
},
|
|
1508
|
+
},
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1511
|
+
// Schema for required field without default
|
|
1512
|
+
export const requiredWithoutDefaultSchema = {
|
|
1513
|
+
schema: {
|
|
1514
|
+
service: {
|
|
1515
|
+
type: 'object',
|
|
1516
|
+
children: {
|
|
1517
|
+
apiKey: {
|
|
1518
|
+
type: 'string',
|
|
1519
|
+
validations: [{ required: true }],
|
|
1520
|
+
},
|
|
1521
|
+
},
|
|
1522
|
+
},
|
|
1523
|
+
},
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// Default-shape validation fixtures
|
|
1527
|
+
export const arrayPrimitiveDefaultsValid = {
|
|
1528
|
+
schema: {
|
|
1529
|
+
ports: {
|
|
1530
|
+
type: 'array',
|
|
1531
|
+
items: { type: 'number' },
|
|
1532
|
+
default: [80, 443],
|
|
1533
|
+
},
|
|
1534
|
+
},
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
export const arrayPrimitiveDefaultsInvalid = {
|
|
1538
|
+
schema: {
|
|
1539
|
+
ports: {
|
|
1540
|
+
type: 'array',
|
|
1541
|
+
items: { type: 'number' },
|
|
1542
|
+
// invalid: contains a string
|
|
1543
|
+
default: [80, '443' as any],
|
|
1544
|
+
},
|
|
1545
|
+
},
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
export const arrayObjectDefaultsInvalidChildType = {
|
|
1549
|
+
schema: {
|
|
1550
|
+
services: {
|
|
1551
|
+
type: 'array',
|
|
1552
|
+
items: {
|
|
1553
|
+
type: 'object',
|
|
1554
|
+
children: {
|
|
1555
|
+
enabled: { type: 'boolean' },
|
|
1556
|
+
path: { type: 'string' },
|
|
1557
|
+
},
|
|
1558
|
+
},
|
|
1559
|
+
// invalid: enabled should be boolean
|
|
1560
|
+
default: [{ enabled: 'true' as any, path: '/var' }],
|
|
1561
|
+
},
|
|
1562
|
+
},
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
export const nestedArrayDefaultsInvalid = {
|
|
1566
|
+
schema: {
|
|
1567
|
+
logs: {
|
|
1568
|
+
type: 'array',
|
|
1569
|
+
items: {
|
|
1570
|
+
type: 'object',
|
|
1571
|
+
children: {
|
|
1572
|
+
name: { type: 'string' },
|
|
1573
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
1574
|
+
},
|
|
1575
|
+
},
|
|
1576
|
+
// invalid: tags contains a number
|
|
1577
|
+
default: [{ name: 'file', tags: ['ok', 1 as any] }],
|
|
1578
|
+
},
|
|
1579
|
+
},
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1582
|
+
export const nestedArrayDefaultsValid = {
|
|
1583
|
+
schema: {
|
|
1584
|
+
logs: {
|
|
1585
|
+
type: 'array',
|
|
1586
|
+
items: {
|
|
1587
|
+
type: 'object',
|
|
1588
|
+
children: {
|
|
1589
|
+
name: { type: 'string' },
|
|
1590
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
1591
|
+
},
|
|
1592
|
+
},
|
|
1593
|
+
default: [{ name: 'file', tags: ['ok', 'x'] }],
|
|
1594
|
+
},
|
|
1595
|
+
},
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1598
|
+
// Nested array of objects inside array of objects (valid)
|
|
1599
|
+
export const nestedArrayOfObjectsDefaultsValid = {
|
|
1600
|
+
schema: {
|
|
1601
|
+
services: {
|
|
1602
|
+
type: 'array',
|
|
1603
|
+
items: {
|
|
1604
|
+
type: 'object',
|
|
1605
|
+
children: {
|
|
1606
|
+
name: { type: 'string' },
|
|
1607
|
+
handlers: {
|
|
1608
|
+
type: 'array',
|
|
1609
|
+
items: {
|
|
1610
|
+
type: 'object',
|
|
1611
|
+
children: {
|
|
1612
|
+
type: { type: 'string' },
|
|
1613
|
+
retries: { type: 'number' },
|
|
1614
|
+
},
|
|
1615
|
+
},
|
|
1616
|
+
default: [{ type: 'file', retries: 3 }],
|
|
1617
|
+
},
|
|
1618
|
+
},
|
|
1619
|
+
},
|
|
1620
|
+
default: [
|
|
1621
|
+
{ name: 'api' },
|
|
1622
|
+
{ name: 'worker', handlers: [{ type: 'console', retries: 1 }] },
|
|
1623
|
+
],
|
|
1624
|
+
},
|
|
1625
|
+
},
|
|
1626
|
+
defaultVal: {
|
|
1627
|
+
services: [
|
|
1628
|
+
{ name: 'api', handlers: [{ type: 'file', retries: 3 }] },
|
|
1629
|
+
{ name: 'worker', handlers: [{ type: 'console', retries: 1 }] },
|
|
1630
|
+
],
|
|
1631
|
+
},
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
// Nested array of objects inside array of objects (invalid inner element shape)
|
|
1635
|
+
export const nestedArrayOfObjectsDefaultsInvalid = {
|
|
1636
|
+
schema: {
|
|
1637
|
+
services: {
|
|
1638
|
+
type: 'array',
|
|
1639
|
+
items: {
|
|
1640
|
+
type: 'object',
|
|
1641
|
+
children: {
|
|
1642
|
+
name: { type: 'string' },
|
|
1643
|
+
handlers: {
|
|
1644
|
+
type: 'array',
|
|
1645
|
+
items: {
|
|
1646
|
+
type: 'object',
|
|
1647
|
+
children: {
|
|
1648
|
+
type: { type: 'string' },
|
|
1649
|
+
retries: { type: 'number' },
|
|
1650
|
+
},
|
|
1651
|
+
},
|
|
1652
|
+
// invalid: retries should be number, unknown key also invalid
|
|
1653
|
+
default: [
|
|
1654
|
+
{ type: 'file', retries: 'three' as any, extra: true as any },
|
|
1655
|
+
],
|
|
1656
|
+
},
|
|
1657
|
+
},
|
|
1658
|
+
},
|
|
1659
|
+
default: [{ name: 'api' }],
|
|
1660
|
+
},
|
|
1661
|
+
},
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
// Wrong choice default at primitive level
|
|
1665
|
+
export const wrongChoiceDefaultSchema = {
|
|
1666
|
+
schema: {
|
|
1667
|
+
mode: {
|
|
1668
|
+
type: 'string',
|
|
1669
|
+
default: 'good',
|
|
1670
|
+
validations: [{ choices: ['hello', 'bye'] }],
|
|
1671
|
+
},
|
|
1672
|
+
},
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1675
|
+
// Wrong choice default nested in array of objects
|
|
1676
|
+
export const nestedWrongChoiceDefaultSchema = {
|
|
1677
|
+
schema: {
|
|
1678
|
+
logs: {
|
|
1679
|
+
type: 'array',
|
|
1680
|
+
items: {
|
|
1681
|
+
type: 'object',
|
|
1682
|
+
children: {
|
|
1683
|
+
type: {
|
|
1684
|
+
type: 'string',
|
|
1685
|
+
default: 'unknown',
|
|
1686
|
+
validations: [{ choices: ['file', 'console', 'loki'] }],
|
|
1687
|
+
},
|
|
1688
|
+
level: { type: 'string', default: 'info' },
|
|
1689
|
+
},
|
|
1690
|
+
},
|
|
1691
|
+
default: [{}],
|
|
1692
|
+
},
|
|
1693
|
+
},
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1696
|
+
export const arraySchemaDefaultValuePairSample = {
|
|
1697
|
+
schema: {
|
|
1698
|
+
stringArray: {
|
|
1699
|
+
type: 'array',
|
|
1700
|
+
default: ['item1', 'item2', 'item3'],
|
|
1701
|
+
description: 'array of strings',
|
|
1702
|
+
items: {
|
|
1703
|
+
type: 'string',
|
|
1704
|
+
},
|
|
1705
|
+
},
|
|
1706
|
+
numberArray: {
|
|
1707
|
+
type: 'array',
|
|
1708
|
+
default: [1, 2, 3, 42],
|
|
1709
|
+
description: 'array of numbers',
|
|
1710
|
+
items: {
|
|
1711
|
+
type: 'number',
|
|
1712
|
+
},
|
|
1713
|
+
},
|
|
1714
|
+
emptyArray: {
|
|
1715
|
+
type: 'array',
|
|
1716
|
+
default: [],
|
|
1717
|
+
description: 'empty array',
|
|
1718
|
+
items: {
|
|
1719
|
+
type: 'string',
|
|
1720
|
+
},
|
|
1721
|
+
},
|
|
1722
|
+
noDefaultArray: {
|
|
1723
|
+
type: 'array',
|
|
1724
|
+
description: 'array without default',
|
|
1725
|
+
items: {
|
|
1726
|
+
type: 'boolean',
|
|
1727
|
+
},
|
|
1728
|
+
},
|
|
1729
|
+
},
|
|
1730
|
+
defaultVal: {
|
|
1731
|
+
stringArray: ['item1', 'item2', 'item3'],
|
|
1732
|
+
numberArray: [1, 2, 3, 42],
|
|
1733
|
+
emptyArray: [],
|
|
1734
|
+
},
|
|
1735
|
+
};
|