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