@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-cjs.js
CHANGED
|
@@ -2761,13 +2761,22 @@ class InvalidSchemaError$3 extends Error {
|
|
|
2761
2761
|
|
|
2762
2762
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
2763
2763
|
|
|
2764
|
+
const Schema$R = schema$5;
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
const compile$O = (schema) => Schema$R.value(schema);
|
|
2768
|
+
const interpret$O = () => true;
|
|
2769
|
+
|
|
2770
|
+
var metaData$4 = { compile: compile$O, interpret: interpret$O };
|
|
2771
|
+
|
|
2764
2772
|
const curry = justCurryIt;
|
|
2765
2773
|
const PubSub$1 = pubsub.exports;
|
|
2766
2774
|
const { resolveUrl } = common$1;
|
|
2767
2775
|
const Instance$E = instance;
|
|
2768
|
-
const Schema$
|
|
2776
|
+
const Schema$Q = schema$5;
|
|
2769
2777
|
const InvalidSchemaError$2 = invalidSchemaError;
|
|
2770
2778
|
const MediaTypes = mediaTypes;
|
|
2779
|
+
const metaData$3 = metaData$4;
|
|
2771
2780
|
|
|
2772
2781
|
|
|
2773
2782
|
const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
|
|
@@ -2781,19 +2790,19 @@ MediaTypes.addPlugin("application/schema+json", {
|
|
|
2781
2790
|
});
|
|
2782
2791
|
|
|
2783
2792
|
const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
|
|
2784
|
-
const compiled = await compile$
|
|
2785
|
-
const interpretAst = (value, outputFormat) => interpret$
|
|
2793
|
+
const compiled = await compile$N(schema);
|
|
2794
|
+
const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
|
|
2786
2795
|
|
|
2787
2796
|
return value === undefined ? interpretAst : interpretAst(value, outputFormat);
|
|
2788
2797
|
};
|
|
2789
2798
|
|
|
2790
|
-
const compile$
|
|
2799
|
+
const compile$N = async (schema) => {
|
|
2791
2800
|
const ast = { metaData: {} };
|
|
2792
2801
|
const schemaUri = await compileSchema(schema, ast);
|
|
2793
2802
|
return { ast, schemaUri };
|
|
2794
2803
|
};
|
|
2795
2804
|
|
|
2796
|
-
const interpret$
|
|
2805
|
+
const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
2797
2806
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
2798
2807
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
2799
2808
|
}
|
|
@@ -2847,7 +2856,7 @@ const setShouldMetaValidate = (isEnabled) => {
|
|
|
2847
2856
|
};
|
|
2848
2857
|
|
|
2849
2858
|
const _keywords = {};
|
|
2850
|
-
const getKeyword = (id) => _keywords[id];
|
|
2859
|
+
const getKeyword = (id) => _keywords[id] || metaData$3;
|
|
2851
2860
|
const hasKeyword = (id) => id in _keywords;
|
|
2852
2861
|
const addKeyword = (id, keywordHandler) => {
|
|
2853
2862
|
_keywords[id] = {
|
|
@@ -2868,10 +2877,10 @@ const compileSchema = async (schema, ast) => {
|
|
|
2868
2877
|
|
|
2869
2878
|
// Vocabularies
|
|
2870
2879
|
if (!hasKeyword(`${schema.dialectId}#validate`)) {
|
|
2871
|
-
const metaSchema = await Schema$
|
|
2880
|
+
const metaSchema = await Schema$Q.get(schema.dialectId);
|
|
2872
2881
|
|
|
2873
2882
|
// Check for mandatory vocabularies
|
|
2874
|
-
const mandatoryVocabularies = Schema$
|
|
2883
|
+
const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
|
|
2875
2884
|
mandatoryVocabularies.forEach((vocabularyId) => {
|
|
2876
2885
|
if (!metaSchema.vocabulary[vocabularyId]) {
|
|
2877
2886
|
throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
|
|
@@ -2894,13 +2903,13 @@ const compileSchema = async (schema, ast) => {
|
|
|
2894
2903
|
|
|
2895
2904
|
// Meta validation
|
|
2896
2905
|
if (shouldMetaValidate && !schema.validated) {
|
|
2897
|
-
Schema$
|
|
2906
|
+
Schema$Q.markValidated(schema.id);
|
|
2898
2907
|
|
|
2899
2908
|
// Compile
|
|
2900
2909
|
if (!(schema.dialectId in metaValidators)) {
|
|
2901
|
-
const metaSchema = await Schema$
|
|
2902
|
-
const compiledSchema = await compile$
|
|
2903
|
-
metaValidators[metaSchema.id] = interpret$
|
|
2910
|
+
const metaSchema = await Schema$Q.get(schema.dialectId);
|
|
2911
|
+
const compiledSchema = await compile$N(metaSchema);
|
|
2912
|
+
metaValidators[metaSchema.id] = interpret$N(compiledSchema);
|
|
2904
2913
|
}
|
|
2905
2914
|
|
|
2906
2915
|
// Interpret
|
|
@@ -2923,7 +2932,7 @@ const compileSchema = async (schema, ast) => {
|
|
|
2923
2932
|
};
|
|
2924
2933
|
|
|
2925
2934
|
const followReferences = async (doc) => {
|
|
2926
|
-
return Schema$
|
|
2935
|
+
return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
|
|
2927
2936
|
};
|
|
2928
2937
|
|
|
2929
2938
|
const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
|
|
@@ -2951,26 +2960,18 @@ const getKeywordId = (schemaUri, ast) => {
|
|
|
2951
2960
|
};
|
|
2952
2961
|
|
|
2953
2962
|
const add = (schema, url = "", defaultSchemaVersion = "") => {
|
|
2954
|
-
const id = Schema$
|
|
2963
|
+
const id = Schema$Q.add(schema, url, defaultSchemaVersion);
|
|
2955
2964
|
delete metaValidators[id];
|
|
2956
2965
|
};
|
|
2957
2966
|
|
|
2958
2967
|
var core$2 = {
|
|
2959
|
-
validate: validate$2, compile: compile$
|
|
2968
|
+
validate: validate$2, compile: compile$N, interpret: interpret$N,
|
|
2960
2969
|
setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
|
|
2961
2970
|
add, getKeyword, hasKeyword, defineVocabulary,
|
|
2962
2971
|
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
|
|
2963
2972
|
addMediaTypePlugin: MediaTypes.addPlugin
|
|
2964
2973
|
};
|
|
2965
2974
|
|
|
2966
|
-
const Schema$Q = schema$5;
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
const compile$N = (schema) => Schema$Q.value(schema);
|
|
2970
|
-
const interpret$N = () => true;
|
|
2971
|
-
|
|
2972
|
-
var metaData$3 = { compile: compile$N, interpret: interpret$N };
|
|
2973
|
-
|
|
2974
2975
|
const Pact$9 = lib$2;
|
|
2975
2976
|
const PubSub = pubsub.exports;
|
|
2976
2977
|
const Core$x = core$2;
|
|
@@ -2994,7 +2995,7 @@ const compile$M = async (schema, ast) => {
|
|
|
2994
2995
|
typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
|
|
2995
2996
|
Schema$P.entries,
|
|
2996
2997
|
Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
|
|
2997
|
-
Pact$9.filter(([keywordId]) =>
|
|
2998
|
+
Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
|
|
2998
2999
|
Pact$9.map(async ([keywordId, keywordSchema]) => {
|
|
2999
3000
|
const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
|
|
3000
3001
|
return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
|
|
@@ -3070,7 +3071,7 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
|
|
|
3070
3071
|
|
|
3071
3072
|
var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
3072
3073
|
|
|
3073
|
-
const metaData$2 = metaData$
|
|
3074
|
+
const metaData$2 = metaData$4;
|
|
3074
3075
|
const validate = validate$1;
|
|
3075
3076
|
|
|
3076
3077
|
|