vscode-json-languageservice 5.3.7 → 5.3.9

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.
@@ -727,10 +727,18 @@ function validate(n, schema, validationResult, matchingSchemas, context) {
727
727
  }
728
728
  if (schema.uniqueItems === true) {
729
729
  const values = getNodeValue(node);
730
- const duplicates = values.some((value, index) => {
731
- return index !== values.lastIndexOf(value);
732
- });
733
- if (duplicates) {
730
+ function hasDuplicates() {
731
+ for (let i = 0; i < values.length - 1; i++) {
732
+ const value = values[i];
733
+ for (let j = i + 1; j < values.length; j++) {
734
+ if (equals(value, values[j])) {
735
+ return true;
736
+ }
737
+ }
738
+ }
739
+ return false;
740
+ }
741
+ if (hasDuplicates()) {
734
742
  validationResult.problems.push({
735
743
  location: { offset: node.offset, length: node.length },
736
744
  message: l10n.t('Array has duplicate items.')
@@ -263,6 +263,9 @@ export class JSONSchemaService {
263
263
  const errorMessage = l10n.t('Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
264
264
  return this.promise.resolve(new UnresolvedSchema({}, [errorMessage]));
265
265
  }
266
+ if (url.startsWith('http://json-schema.org/')) {
267
+ url = 'https' + url.substring(4); // always access json-schema.org with https. See https://github.com/microsoft/vscode/issues/195189
268
+ }
266
269
  return this.requestService(url).then(content => {
267
270
  if (!content) {
268
271
  const errorMessage = l10n.t('Unable to load schema from \'{0}\': No content.', toDisplayString(url));
@@ -754,10 +754,18 @@
754
754
  }
755
755
  if (schema.uniqueItems === true) {
756
756
  const values = getNodeValue(node);
757
- const duplicates = values.some((value, index) => {
758
- return index !== values.lastIndexOf(value);
759
- });
760
- if (duplicates) {
757
+ function hasDuplicates() {
758
+ for (let i = 0; i < values.length - 1; i++) {
759
+ const value = values[i];
760
+ for (let j = i + 1; j < values.length; j++) {
761
+ if ((0, objects_1.equals)(value, values[j])) {
762
+ return true;
763
+ }
764
+ }
765
+ }
766
+ return false;
767
+ }
768
+ if (hasDuplicates()) {
761
769
  validationResult.problems.push({
762
770
  location: { offset: node.offset, length: node.length },
763
771
  message: l10n.t('Array has duplicate items.')
@@ -277,6 +277,9 @@
277
277
  const errorMessage = l10n.t('Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
278
278
  return this.promise.resolve(new UnresolvedSchema({}, [errorMessage]));
279
279
  }
280
+ if (url.startsWith('http://json-schema.org/')) {
281
+ url = 'https' + url.substring(4); // always access json-schema.org with https. See https://github.com/microsoft/vscode/issues/195189
282
+ }
280
283
  return this.requestService(url).then(content => {
281
284
  if (!content) {
282
285
  const errorMessage = l10n.t('Unable to load schema from \'{0}\': No content.', toDisplayString(url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vscode-json-languageservice",
3
- "version": "5.3.7",
3
+ "version": "5.3.9",
4
4
  "description": "Language service for JSON",
5
5
  "main": "./lib/umd/jsonLanguageService.js",
6
6
  "typings": "./lib/umd/jsonLanguageService",
@@ -15,22 +15,22 @@
15
15
  "url": "https://github.com/Microsoft/vscode-json-languageservice"
16
16
  },
17
17
  "devDependencies": {
18
- "@types/mocha": "^10.0.2",
18
+ "@types/mocha": "^10.0.6",
19
19
  "@types/node": "16.x",
20
- "@typescript-eslint/eslint-plugin": "^6.7.4",
21
- "@typescript-eslint/parser": "^6.7.4",
22
- "eslint": "^8.51.0",
20
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
21
+ "@typescript-eslint/parser": "^6.19.1",
22
+ "eslint": "^8.56.0",
23
23
  "json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
24
24
  "mocha": "^10.2.0",
25
25
  "rimraf": "^5.0.5",
26
- "typescript": "^5.2.2"
26
+ "typescript": "^5.3.3"
27
27
  },
28
28
  "dependencies": {
29
- "jsonc-parser": "^3.2.0",
29
+ "jsonc-parser": "^3.2.1",
30
30
  "vscode-languageserver-textdocument": "^1.0.11",
31
31
  "vscode-languageserver-types": "^3.17.5",
32
32
  "vscode-uri": "^3.0.8",
33
- "@vscode/l10n": "^0.0.16"
33
+ "@vscode/l10n": "^0.0.18"
34
34
  },
35
35
  "scripts": {
36
36
  "prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",