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