@formspec/build 0.1.0-alpha.41 → 0.1.0-alpha.42
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/dist/browser.cjs +79 -6
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +79 -6
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +80 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +80 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +79 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +79 -6
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +79 -6
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +79 -6
- package/dist/internals.js.map +1 -1
- package/package.json +4 -4
package/dist/browser.js
CHANGED
|
@@ -1423,6 +1423,66 @@ function generateCustomType(type, ctx) {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
return registration.toJsonSchema(type.payload, ctx.vendorPrefix);
|
|
1425
1425
|
}
|
|
1426
|
+
var JSON_SCHEMA_STRUCTURAL_KEYWORDS = /* @__PURE__ */ new Set([
|
|
1427
|
+
"$schema",
|
|
1428
|
+
"$ref",
|
|
1429
|
+
"$defs",
|
|
1430
|
+
"$id",
|
|
1431
|
+
"$anchor",
|
|
1432
|
+
"$dynamicRef",
|
|
1433
|
+
"$dynamicAnchor",
|
|
1434
|
+
"$vocabulary",
|
|
1435
|
+
"$comment",
|
|
1436
|
+
"type",
|
|
1437
|
+
"enum",
|
|
1438
|
+
"const",
|
|
1439
|
+
"properties",
|
|
1440
|
+
"patternProperties",
|
|
1441
|
+
"additionalProperties",
|
|
1442
|
+
"required",
|
|
1443
|
+
"items",
|
|
1444
|
+
"prefixItems",
|
|
1445
|
+
"additionalItems",
|
|
1446
|
+
"contains",
|
|
1447
|
+
"allOf",
|
|
1448
|
+
"oneOf",
|
|
1449
|
+
"anyOf",
|
|
1450
|
+
"not",
|
|
1451
|
+
"if",
|
|
1452
|
+
"then",
|
|
1453
|
+
"else",
|
|
1454
|
+
"minimum",
|
|
1455
|
+
"maximum",
|
|
1456
|
+
"exclusiveMinimum",
|
|
1457
|
+
"exclusiveMaximum",
|
|
1458
|
+
"multipleOf",
|
|
1459
|
+
"minLength",
|
|
1460
|
+
"maxLength",
|
|
1461
|
+
"pattern",
|
|
1462
|
+
"minItems",
|
|
1463
|
+
"maxItems",
|
|
1464
|
+
"uniqueItems",
|
|
1465
|
+
"minProperties",
|
|
1466
|
+
"maxProperties",
|
|
1467
|
+
"minContains",
|
|
1468
|
+
"maxContains",
|
|
1469
|
+
"format",
|
|
1470
|
+
"title",
|
|
1471
|
+
"description",
|
|
1472
|
+
"default",
|
|
1473
|
+
"deprecated",
|
|
1474
|
+
"readOnly",
|
|
1475
|
+
"writeOnly",
|
|
1476
|
+
"examples",
|
|
1477
|
+
"dependentRequired",
|
|
1478
|
+
"dependentSchemas",
|
|
1479
|
+
"propertyNames",
|
|
1480
|
+
"unevaluatedItems",
|
|
1481
|
+
"unevaluatedProperties",
|
|
1482
|
+
"contentEncoding",
|
|
1483
|
+
"contentMediaType",
|
|
1484
|
+
"contentSchema"
|
|
1485
|
+
]);
|
|
1426
1486
|
function applyCustomConstraint(schema, constraint, ctx) {
|
|
1427
1487
|
const registration = ctx.extensionRegistry?.findConstraint(constraint.constraintId);
|
|
1428
1488
|
if (registration === void 0) {
|
|
@@ -1430,12 +1490,25 @@ function applyCustomConstraint(schema, constraint, ctx) {
|
|
|
1430
1490
|
`Cannot generate JSON Schema for custom constraint "${constraint.constraintId}" without a matching extension registration`
|
|
1431
1491
|
);
|
|
1432
1492
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1493
|
+
const extensionSchema = registration.toJsonSchema(constraint.payload, ctx.vendorPrefix);
|
|
1494
|
+
if (registration.emitsVocabularyKeywords) {
|
|
1495
|
+
const target = schema;
|
|
1496
|
+
for (const [key, value] of Object.entries(extensionSchema)) {
|
|
1497
|
+
if (JSON_SCHEMA_STRUCTURAL_KEYWORDS.has(key)) {
|
|
1498
|
+
throw new Error(
|
|
1499
|
+
`Custom constraint "${constraint.constraintId}" with emitsVocabularyKeywords must not overwrite standard JSON Schema keyword "${key}"`
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
target[key] = value;
|
|
1503
|
+
}
|
|
1504
|
+
} else {
|
|
1505
|
+
assignVendorPrefixedExtensionKeywords(
|
|
1506
|
+
schema,
|
|
1507
|
+
extensionSchema,
|
|
1508
|
+
ctx.vendorPrefix,
|
|
1509
|
+
`custom constraint "${constraint.constraintId}"`
|
|
1510
|
+
);
|
|
1511
|
+
}
|
|
1439
1512
|
}
|
|
1440
1513
|
function applyCustomAnnotation(schema, annotation, ctx) {
|
|
1441
1514
|
const registration = ctx.extensionRegistry?.findAnnotation(annotation.annotationId);
|