@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/internals.js
CHANGED
|
@@ -4833,6 +4833,66 @@ function generateCustomType(type, ctx) {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
return registration.toJsonSchema(type.payload, ctx.vendorPrefix);
|
|
4835
4835
|
}
|
|
4836
|
+
var JSON_SCHEMA_STRUCTURAL_KEYWORDS = /* @__PURE__ */ new Set([
|
|
4837
|
+
"$schema",
|
|
4838
|
+
"$ref",
|
|
4839
|
+
"$defs",
|
|
4840
|
+
"$id",
|
|
4841
|
+
"$anchor",
|
|
4842
|
+
"$dynamicRef",
|
|
4843
|
+
"$dynamicAnchor",
|
|
4844
|
+
"$vocabulary",
|
|
4845
|
+
"$comment",
|
|
4846
|
+
"type",
|
|
4847
|
+
"enum",
|
|
4848
|
+
"const",
|
|
4849
|
+
"properties",
|
|
4850
|
+
"patternProperties",
|
|
4851
|
+
"additionalProperties",
|
|
4852
|
+
"required",
|
|
4853
|
+
"items",
|
|
4854
|
+
"prefixItems",
|
|
4855
|
+
"additionalItems",
|
|
4856
|
+
"contains",
|
|
4857
|
+
"allOf",
|
|
4858
|
+
"oneOf",
|
|
4859
|
+
"anyOf",
|
|
4860
|
+
"not",
|
|
4861
|
+
"if",
|
|
4862
|
+
"then",
|
|
4863
|
+
"else",
|
|
4864
|
+
"minimum",
|
|
4865
|
+
"maximum",
|
|
4866
|
+
"exclusiveMinimum",
|
|
4867
|
+
"exclusiveMaximum",
|
|
4868
|
+
"multipleOf",
|
|
4869
|
+
"minLength",
|
|
4870
|
+
"maxLength",
|
|
4871
|
+
"pattern",
|
|
4872
|
+
"minItems",
|
|
4873
|
+
"maxItems",
|
|
4874
|
+
"uniqueItems",
|
|
4875
|
+
"minProperties",
|
|
4876
|
+
"maxProperties",
|
|
4877
|
+
"minContains",
|
|
4878
|
+
"maxContains",
|
|
4879
|
+
"format",
|
|
4880
|
+
"title",
|
|
4881
|
+
"description",
|
|
4882
|
+
"default",
|
|
4883
|
+
"deprecated",
|
|
4884
|
+
"readOnly",
|
|
4885
|
+
"writeOnly",
|
|
4886
|
+
"examples",
|
|
4887
|
+
"dependentRequired",
|
|
4888
|
+
"dependentSchemas",
|
|
4889
|
+
"propertyNames",
|
|
4890
|
+
"unevaluatedItems",
|
|
4891
|
+
"unevaluatedProperties",
|
|
4892
|
+
"contentEncoding",
|
|
4893
|
+
"contentMediaType",
|
|
4894
|
+
"contentSchema"
|
|
4895
|
+
]);
|
|
4836
4896
|
function applyCustomConstraint(schema, constraint, ctx) {
|
|
4837
4897
|
const registration = ctx.extensionRegistry?.findConstraint(constraint.constraintId);
|
|
4838
4898
|
if (registration === void 0) {
|
|
@@ -4840,12 +4900,25 @@ function applyCustomConstraint(schema, constraint, ctx) {
|
|
|
4840
4900
|
`Cannot generate JSON Schema for custom constraint "${constraint.constraintId}" without a matching extension registration`
|
|
4841
4901
|
);
|
|
4842
4902
|
}
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4903
|
+
const extensionSchema = registration.toJsonSchema(constraint.payload, ctx.vendorPrefix);
|
|
4904
|
+
if (registration.emitsVocabularyKeywords) {
|
|
4905
|
+
const target = schema;
|
|
4906
|
+
for (const [key, value] of Object.entries(extensionSchema)) {
|
|
4907
|
+
if (JSON_SCHEMA_STRUCTURAL_KEYWORDS.has(key)) {
|
|
4908
|
+
throw new Error(
|
|
4909
|
+
`Custom constraint "${constraint.constraintId}" with emitsVocabularyKeywords must not overwrite standard JSON Schema keyword "${key}"`
|
|
4910
|
+
);
|
|
4911
|
+
}
|
|
4912
|
+
target[key] = value;
|
|
4913
|
+
}
|
|
4914
|
+
} else {
|
|
4915
|
+
assignVendorPrefixedExtensionKeywords(
|
|
4916
|
+
schema,
|
|
4917
|
+
extensionSchema,
|
|
4918
|
+
ctx.vendorPrefix,
|
|
4919
|
+
`custom constraint "${constraint.constraintId}"`
|
|
4920
|
+
);
|
|
4921
|
+
}
|
|
4849
4922
|
}
|
|
4850
4923
|
function applyCustomAnnotation(schema, annotation, ctx) {
|
|
4851
4924
|
const registration = ctx.extensionRegistry?.findAnnotation(annotation.annotationId);
|