@hyperjump/json-schema 0.21.0 → 0.22.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/README.md +1 -0
- package/dist/json-schema-amd.js +26 -25
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +1 -1
- package/dist/json-schema-amd.min.js.map +1 -1
- package/dist/json-schema-cjs.js +26 -25
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +1 -1
- package/dist/json-schema-cjs.min.js.map +1 -1
- package/dist/json-schema-esm.js +26 -25
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +1 -1
- package/dist/json-schema-esm.min.js.map +1 -1
- package/dist/json-schema-iife.js +26 -25
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +1 -1
- package/dist/json-schema-iife.min.js.map +1 -1
- package/dist/json-schema-system.js +26 -25
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +1 -1
- package/dist/json-schema-system.min.js.map +1 -1
- package/dist/json-schema-umd.js +26 -25
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +1 -1
- package/dist/json-schema-umd.min.js.map +1 -1
- package/package.json +2 -2
package/dist/json-schema-esm.js
CHANGED
|
@@ -2757,13 +2757,22 @@ class InvalidSchemaError$3 extends Error {
|
|
|
2757
2757
|
|
|
2758
2758
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
2759
2759
|
|
|
2760
|
+
const Schema$R = schema$5;
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
const compile$O = (schema) => Schema$R.value(schema);
|
|
2764
|
+
const interpret$O = () => true;
|
|
2765
|
+
|
|
2766
|
+
var metaData$4 = { compile: compile$O, interpret: interpret$O };
|
|
2767
|
+
|
|
2760
2768
|
const curry = justCurryIt;
|
|
2761
2769
|
const PubSub$1 = pubsub.exports;
|
|
2762
2770
|
const { resolveUrl } = common$1;
|
|
2763
2771
|
const Instance$E = instance;
|
|
2764
|
-
const Schema$
|
|
2772
|
+
const Schema$Q = schema$5;
|
|
2765
2773
|
const InvalidSchemaError$2 = invalidSchemaError;
|
|
2766
2774
|
const MediaTypes = mediaTypes;
|
|
2775
|
+
const metaData$3 = metaData$4;
|
|
2767
2776
|
|
|
2768
2777
|
|
|
2769
2778
|
const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
|
|
@@ -2777,19 +2786,19 @@ MediaTypes.addPlugin("application/schema+json", {
|
|
|
2777
2786
|
});
|
|
2778
2787
|
|
|
2779
2788
|
const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
|
|
2780
|
-
const compiled = await compile$
|
|
2781
|
-
const interpretAst = (value, outputFormat) => interpret$
|
|
2789
|
+
const compiled = await compile$N(schema);
|
|
2790
|
+
const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
|
|
2782
2791
|
|
|
2783
2792
|
return value === undefined ? interpretAst : interpretAst(value, outputFormat);
|
|
2784
2793
|
};
|
|
2785
2794
|
|
|
2786
|
-
const compile$
|
|
2795
|
+
const compile$N = async (schema) => {
|
|
2787
2796
|
const ast = { metaData: {} };
|
|
2788
2797
|
const schemaUri = await compileSchema(schema, ast);
|
|
2789
2798
|
return { ast, schemaUri };
|
|
2790
2799
|
};
|
|
2791
2800
|
|
|
2792
|
-
const interpret$
|
|
2801
|
+
const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
2793
2802
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
2794
2803
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
2795
2804
|
}
|
|
@@ -2843,7 +2852,7 @@ const setShouldMetaValidate = (isEnabled) => {
|
|
|
2843
2852
|
};
|
|
2844
2853
|
|
|
2845
2854
|
const _keywords = {};
|
|
2846
|
-
const getKeyword = (id) => _keywords[id];
|
|
2855
|
+
const getKeyword = (id) => _keywords[id] || metaData$3;
|
|
2847
2856
|
const hasKeyword = (id) => id in _keywords;
|
|
2848
2857
|
const addKeyword = (id, keywordHandler) => {
|
|
2849
2858
|
_keywords[id] = {
|
|
@@ -2864,10 +2873,10 @@ const compileSchema = async (schema, ast) => {
|
|
|
2864
2873
|
|
|
2865
2874
|
// Vocabularies
|
|
2866
2875
|
if (!hasKeyword(`${schema.dialectId}#validate`)) {
|
|
2867
|
-
const metaSchema = await Schema$
|
|
2876
|
+
const metaSchema = await Schema$Q.get(schema.dialectId);
|
|
2868
2877
|
|
|
2869
2878
|
// Check for mandatory vocabularies
|
|
2870
|
-
const mandatoryVocabularies = Schema$
|
|
2879
|
+
const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
|
|
2871
2880
|
mandatoryVocabularies.forEach((vocabularyId) => {
|
|
2872
2881
|
if (!metaSchema.vocabulary[vocabularyId]) {
|
|
2873
2882
|
throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
|
|
@@ -2890,13 +2899,13 @@ const compileSchema = async (schema, ast) => {
|
|
|
2890
2899
|
|
|
2891
2900
|
// Meta validation
|
|
2892
2901
|
if (shouldMetaValidate && !schema.validated) {
|
|
2893
|
-
Schema$
|
|
2902
|
+
Schema$Q.markValidated(schema.id);
|
|
2894
2903
|
|
|
2895
2904
|
// Compile
|
|
2896
2905
|
if (!(schema.dialectId in metaValidators)) {
|
|
2897
|
-
const metaSchema = await Schema$
|
|
2898
|
-
const compiledSchema = await compile$
|
|
2899
|
-
metaValidators[metaSchema.id] = interpret$
|
|
2906
|
+
const metaSchema = await Schema$Q.get(schema.dialectId);
|
|
2907
|
+
const compiledSchema = await compile$N(metaSchema);
|
|
2908
|
+
metaValidators[metaSchema.id] = interpret$N(compiledSchema);
|
|
2900
2909
|
}
|
|
2901
2910
|
|
|
2902
2911
|
// Interpret
|
|
@@ -2919,7 +2928,7 @@ const compileSchema = async (schema, ast) => {
|
|
|
2919
2928
|
};
|
|
2920
2929
|
|
|
2921
2930
|
const followReferences = async (doc) => {
|
|
2922
|
-
return Schema$
|
|
2931
|
+
return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
|
|
2923
2932
|
};
|
|
2924
2933
|
|
|
2925
2934
|
const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
|
|
@@ -2947,26 +2956,18 @@ const getKeywordId = (schemaUri, ast) => {
|
|
|
2947
2956
|
};
|
|
2948
2957
|
|
|
2949
2958
|
const add = (schema, url = "", defaultSchemaVersion = "") => {
|
|
2950
|
-
const id = Schema$
|
|
2959
|
+
const id = Schema$Q.add(schema, url, defaultSchemaVersion);
|
|
2951
2960
|
delete metaValidators[id];
|
|
2952
2961
|
};
|
|
2953
2962
|
|
|
2954
2963
|
var core$2 = {
|
|
2955
|
-
validate: validate$2, compile: compile$
|
|
2964
|
+
validate: validate$2, compile: compile$N, interpret: interpret$N,
|
|
2956
2965
|
setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
|
|
2957
2966
|
add, getKeyword, hasKeyword, defineVocabulary,
|
|
2958
2967
|
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
|
|
2959
2968
|
addMediaTypePlugin: MediaTypes.addPlugin
|
|
2960
2969
|
};
|
|
2961
2970
|
|
|
2962
|
-
const Schema$Q = schema$5;
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
const compile$N = (schema) => Schema$Q.value(schema);
|
|
2966
|
-
const interpret$N = () => true;
|
|
2967
|
-
|
|
2968
|
-
var metaData$3 = { compile: compile$N, interpret: interpret$N };
|
|
2969
|
-
|
|
2970
2971
|
const Pact$9 = lib$2;
|
|
2971
2972
|
const PubSub = pubsub.exports;
|
|
2972
2973
|
const Core$x = core$2;
|
|
@@ -2990,7 +2991,7 @@ const compile$M = async (schema, ast) => {
|
|
|
2990
2991
|
typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
|
|
2991
2992
|
Schema$P.entries,
|
|
2992
2993
|
Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
|
|
2993
|
-
Pact$9.filter(([keywordId]) =>
|
|
2994
|
+
Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
|
|
2994
2995
|
Pact$9.map(async ([keywordId, keywordSchema]) => {
|
|
2995
2996
|
const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
|
|
2996
2997
|
return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
|
|
@@ -3066,7 +3067,7 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
|
|
|
3066
3067
|
|
|
3067
3068
|
var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
3068
3069
|
|
|
3069
|
-
const metaData$2 = metaData$
|
|
3070
|
+
const metaData$2 = metaData$4;
|
|
3070
3071
|
const validate = validate$1;
|
|
3071
3072
|
|
|
3072
3073
|
|