json-schema-library 11.6.2 → 11.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-schema-library",
3
- "version": "11.6.2",
3
+ "version": "11.6.4",
4
4
  "description": "Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation",
5
5
  "types": "./dist/index.d.cts",
6
6
  "exports": {
@@ -103,7 +103,7 @@
103
103
  "@sagold/json-pointer": "^7.2.1",
104
104
  "fast-copy": "^4.0.4",
105
105
  "fast-deep-equal": "^3.1.3",
106
- "uri-js": "^4.4.1",
106
+ "fast-uri": "^4.2.1",
107
107
  "valid-url": "^1.0.9"
108
108
  },
109
109
  "resolutions": {
@@ -0,0 +1,2 @@
1
+ onlyBuiltDependencies:
2
+ - esbuild
package/src/SchemaNode.ts CHANGED
@@ -583,15 +583,20 @@ export const SchemaNodeMethods = {
583
583
  schemaValidation = sanitizeErrors(schemaValidation);
584
584
  const schemaErrors: JsonError[] = [];
585
585
  const schemaAnnotations: JsonAnnotation[] = [];
586
+ const remoteSchemaId = remoteNode.context.rootNode.$id ?? resolveUri(url);
586
587
  schemaValidation.forEach((error) => {
587
588
  if (isJsonError(error)) {
589
+ error.data.schemaId = remoteSchemaId;
588
590
  schemaErrors.push(error);
589
591
  } else if (isJsonAnnotation(error)) {
592
+ error.data.schemaId = remoteSchemaId;
590
593
  schemaAnnotations.push(error);
591
594
  }
592
595
  });
593
- node.schemaErrors = schemaErrors;
594
- node.schemaAnnotations = schemaAnnotations;
596
+ // accumulate diagnostics instead of overwriting so that registering
597
+ // multiple remotes retains all of their errors/annotations, see #116
598
+ node.schemaErrors = (node.schemaErrors ?? []).concat(schemaErrors);
599
+ node.schemaAnnotations = (node.schemaAnnotations ?? []).concat(schemaAnnotations);
595
600
 
596
601
  return node;
597
602
  },
@@ -1,4 +1,4 @@
1
- import { resolve } from "uri-js";
1
+ import { resolve } from "fast-uri";
2
2
 
3
3
  const suffixes = /(#)+$/;
4
4
  const trailingHash = /#$/;