@hyperjump/json-schema 0.18.0 → 0.18.4

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.
@@ -60,8 +60,14 @@ var pubsub = createCommonjsModule(function (module, exports) {
60
60
  (function (root, factory){
61
61
 
62
62
  var PubSub = {};
63
- root.PubSub = PubSub;
64
- factory(PubSub);
63
+
64
+ if (root.PubSub) {
65
+ PubSub = root.PubSub;
66
+ console.warn("PubSub already loaded, using existing version");
67
+ } else {
68
+ root.PubSub = PubSub;
69
+ factory(PubSub);
70
+ }
65
71
  // CommonJS and Node.js module support
66
72
  {
67
73
  if (module !== undefined && module.exports) {
@@ -797,6 +803,10 @@ const href = (ref) => ref[$__href];
797
803
  const value$2 = (ref) => ref[$__value];
798
804
 
799
805
  var reference = { cons: cons$1, isReference, href, value: value$2 };
806
+ reference.cons;
807
+ reference.isReference;
808
+ reference.href;
809
+ reference.value;
800
810
 
801
811
  const { jsonTypeOf: jsonTypeOf$1 } = common$1;
802
812
 
@@ -1233,7 +1243,7 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
1233
1243
  validated: false
1234
1244
  };
1235
1245
 
1236
- return schemaStore[id];
1246
+ return id;
1237
1247
  };
1238
1248
 
1239
1249
  const processSchema = (subject, id, schemaVersion, pointer, anchors, dynamicAnchors) => {
@@ -1589,10 +1599,8 @@ const getKeywordId = (schemaUri, ast) => {
1589
1599
  };
1590
1600
 
1591
1601
  const add = (schema, url = "", defaultSchemaVersion = "") => {
1592
- const doc = schema$5.add(schema, url, defaultSchemaVersion);
1593
- delete metaValidators[doc.id];
1594
-
1595
- return doc;
1602
+ const id = schema$5.add(schema, url, defaultSchemaVersion);
1603
+ delete metaValidators[id];
1596
1604
  };
1597
1605
 
1598
1606
  var core$2 = {
@@ -1726,7 +1734,7 @@ var keywords$1 = { metaData: metaData$2, validate };
1726
1734
  keywords$1.metaData;
1727
1735
  keywords$1.validate;
1728
1736
 
1729
- var lib$1 = { Core: core$2, Schema: schema$5, Instance: instance, Keywords: keywords$1 };
1737
+ var lib$1 = { Core: core$2, Schema: schema$5, Instance: instance, Reference: reference, Keywords: keywords$1, InvalidSchemaError: invalidSchemaError };
1730
1738
 
1731
1739
  const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
1732
1740
 
@@ -3106,149 +3114,11 @@ var schema$4 = `{
3106
3114
  "default": {}
3107
3115
  }`;
3108
3116
 
3109
- var hyperSchema = `{
3110
- "$schema": "http://json-schema.org/draft-04/hyper-schema#",
3111
- "id": "http://json-schema.org/draft-04/hyper-schema#",
3112
- "title": "JSON Hyper-Schema",
3113
- "allOf": [
3114
- {"$ref": "http://json-schema.org/draft-04/schema#"}
3115
- ],
3116
- "properties": {
3117
- "additionalItems": {
3118
- "anyOf": [
3119
- {"type": "boolean"},
3120
- {"$ref": "#"}
3121
- ]
3122
- },
3123
- "additionalProperties": {
3124
- "anyOf": [
3125
- {"type": "boolean"},
3126
- {"$ref": "#"}
3127
- ]
3128
- },
3129
- "dependencies": {
3130
- "additionalProperties": {
3131
- "anyOf": [
3132
- {"$ref": "#"},
3133
- {"type": "array"}
3134
- ]
3135
- }
3136
- },
3137
- "items": {
3138
- "anyOf": [
3139
- {"$ref": "#"},
3140
- {"$ref": "#/definitions/schemaArray"}
3141
- ]
3142
- },
3143
- "definitions": {
3144
- "additionalProperties": {"$ref": "#"}
3145
- },
3146
- "patternProperties": {
3147
- "additionalProperties": {"$ref": "#"}
3148
- },
3149
- "properties": {
3150
- "additionalProperties": {"$ref": "#"}
3151
- },
3152
- "allOf": {"$ref": "#/definitions/schemaArray"},
3153
- "anyOf": {"$ref": "#/definitions/schemaArray"},
3154
- "oneOf": {"$ref": "#/definitions/schemaArray"},
3155
- "not": { "$ref": "#" },
3156
-
3157
- "links": {
3158
- "type": "array",
3159
- "items": {"$ref": "#/definitions/linkDescription"}
3160
- },
3161
- "fragmentResolution": {
3162
- "type": "string"
3163
- },
3164
- "media": {
3165
- "type": "object",
3166
- "properties": {
3167
- "type": {
3168
- "description": "A media type, as described in RFC 2046",
3169
- "type": "string"
3170
- },
3171
- "binaryEncoding": {
3172
- "description": "A content encoding scheme, as described in RFC 2045",
3173
- "type": "string"
3174
- }
3175
- }
3176
- },
3177
- "pathStart": {
3178
- "description": "Instances' URIs must start with this value for this schema to apply to them",
3179
- "type": "string",
3180
- "format": "uri"
3181
- }
3182
- },
3183
- "definitions": {
3184
- "schemaArray": {
3185
- "type": "array",
3186
- "items": {"$ref": "#"}
3187
- },
3188
- "linkDescription": {
3189
- "title": "Link Description Object",
3190
- "type": "object",
3191
- "required": ["href", "rel"],
3192
- "properties": {
3193
- "href": {
3194
- "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
3195
- "type": "string"
3196
- },
3197
- "rel": {
3198
- "description": "relation to the target resource of the link",
3199
- "type": "string"
3200
- },
3201
- "title": {
3202
- "description": "a title for the link",
3203
- "type": "string"
3204
- },
3205
- "targetSchema": {
3206
- "description": "JSON Schema describing the link target",
3207
- "$ref": "#"
3208
- },
3209
- "mediaType": {
3210
- "description": "media type (as defined by RFC 2046) describing the link target",
3211
- "type": "string"
3212
- },
3213
- "method": {
3214
- "description": "method for requesting the target of the link (e.g. for HTTP this might be \\"GET\\" or \\"DELETE\\")",
3215
- "type": "string"
3216
- },
3217
- "encType": {
3218
- "description": "The media type in which to submit data along with the request",
3219
- "type": "string",
3220
- "default": "application/json"
3221
- },
3222
- "schema": {
3223
- "description": "Schema describing the data to submit along with the request",
3224
- "$ref": "#"
3225
- }
3226
- }
3227
- },
3228
- "readOnly": {
3229
- "description": "If true, indicates that the value of this property is controlled by the server.",
3230
- "type": "boolean",
3231
- "default": false
3232
- }
3233
- },
3234
- "links": [
3235
- {
3236
- "rel": "self",
3237
- "href": "{+id}"
3238
- },
3239
- {
3240
- "rel": "full",
3241
- "href": "{+($ref)}"
3242
- }
3243
- ]
3244
- }`;
3245
-
3246
3117
  const { Core: Core$5, Schema: Schema$5 } = lib$1;
3247
3118
 
3248
3119
 
3249
3120
 
3250
3121
 
3251
-
3252
3122
  // JSON Schema Draft-04
3253
3123
  const schemaVersion$4 = "http://json-schema.org/draft-04/schema";
3254
3124
 
@@ -3291,53 +3161,6 @@ Core$5.defineVocabulary(schemaVersion$4, {
3291
3161
  "uniqueItems": keywords.uniqueItems
3292
3162
  });
3293
3163
 
3294
- // JSON Hyper-Schema Draft-04
3295
- const hyperSchemaVersion = "http://json-schema.org/draft-04/hyper-schema";
3296
-
3297
- Schema$5.setConfig(hyperSchemaVersion, "baseToken", "id");
3298
- Schema$5.setConfig(hyperSchemaVersion, "embeddedToken", "id");
3299
- Schema$5.setConfig(hyperSchemaVersion, "anchorToken", "id");
3300
- Schema$5.setConfig(hyperSchemaVersion, "jrefToken", "$ref");
3301
-
3302
- Schema$5.add(JSON.parse(hyperSchema));
3303
- Core$5.defineVocabulary(hyperSchemaVersion, {
3304
- "validate": keywords.validate,
3305
- "additionalItems": keywords.additionalItems,
3306
- "additionalProperties": keywords.additionalProperties,
3307
- "allOf": keywords.allOf,
3308
- "anyOf": keywords.anyOf,
3309
- "default": keywords.metaData,
3310
- "definitions": keywords.definitions,
3311
- "dependencies": keywords.dependencies,
3312
- "description": keywords.metaData,
3313
- "enum": keywords.enum,
3314
- "format": keywords.metaData,
3315
- "fragmentResolution": keywords.metaData,
3316
- "items": keywords.items,
3317
- "maxItems": keywords.maxItems,
3318
- "minProperties": keywords.minProperties,
3319
- "maxProperties": keywords.maxProperties,
3320
- "maximum": keywords.maximumExclusiveMaximum,
3321
- "media": keywords.metaData,
3322
- "minItems": keywords.minItems,
3323
- "minLength": keywords.minLength,
3324
- "maxLength": keywords.maxLength,
3325
- "minimum": keywords.minimumExclusiveMinimum,
3326
- "multipleOf": keywords.multipleOf,
3327
- "links": keywords.metaData,
3328
- "not": keywords.not,
3329
- "oneOf": keywords.oneOf,
3330
- "pathStart": keywords.metaData,
3331
- "pattern": keywords.pattern,
3332
- "patternProperties": keywords.patternProperties,
3333
- "properties": keywords.properties,
3334
- "readOnly": keywords.metaData,
3335
- "required": keywords.required,
3336
- "title": keywords.metaData,
3337
- "type": keywords.type,
3338
- "uniqueItems": keywords.uniqueItems
3339
- });
3340
-
3341
3164
  var schema$3 = `{
3342
3165
  "$schema": "http://json-schema.org/draft-06/schema#",
3343
3166
  "$id": "http://json-schema.org/draft-06/schema#",
@@ -4699,7 +4522,7 @@ exports.Keywords = lib_12;
4699
4522
  exports.VERBOSE = lib_11;
4700
4523
  exports.add = lib_1;
4701
4524
  exports.compile = lib_4;
4702
- exports['default'] = lib;
4525
+ exports["default"] = lib;
4703
4526
  exports.get = lib_2;
4704
4527
  exports.interpret = lib_5;
4705
4528
  exports.setMetaOutputFormat = lib_6;