Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror-json-schema - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

docs/classes/JSONCompletion.md

6

CHANGELOG.md
# codemirror-json-schema
## 0.7.3
### Patch Changes
- [#103](https://github.com/acao/codemirror-json-schema/pull/103) [`da7f368`](https://github.com/acao/codemirror-json-schema/commit/da7f36888c5efa31b5b32becdf9f839e476eed85) Thanks [@imolorhe](https://github.com/imolorhe)! - Handle generic validation error
## 0.7.2

@@ -4,0 +10,0 @@

6

cjs/index.d.ts

@@ -1,4 +0,4 @@

export { jsonCompletion } from "./json-completion.js";
export { jsonSchemaLinter, type JSONValidationOptions, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover.js";
export { jsonCompletion, JSONCompletion, type JSONCompletionOptions, } from "./json-completion.js";
export { jsonSchemaLinter, JSONValidation, type JSONValidationOptions, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, JSONHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover.js";
export { jsonSchema } from "./bundled.js";

@@ -5,0 +5,0 @@ export type { JSONPointersMap, JSONPointerData, JSONPartialPointerData, } from "./types.js";

@@ -17,10 +17,13 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonSchema = exports.jsonSchemaHover = exports.handleRefresh = exports.jsonSchemaLinter = exports.jsonCompletion = void 0;
exports.jsonSchema = exports.JSONHover = exports.jsonSchemaHover = exports.handleRefresh = exports.JSONValidation = exports.jsonSchemaLinter = exports.JSONCompletion = exports.jsonCompletion = void 0;
var json_completion_js_1 = require("./json-completion.js");
Object.defineProperty(exports, "jsonCompletion", { enumerable: true, get: function () { return json_completion_js_1.jsonCompletion; } });
Object.defineProperty(exports, "JSONCompletion", { enumerable: true, get: function () { return json_completion_js_1.JSONCompletion; } });
var json_validation_js_1 = require("./json-validation.js");
Object.defineProperty(exports, "jsonSchemaLinter", { enumerable: true, get: function () { return json_validation_js_1.jsonSchemaLinter; } });
Object.defineProperty(exports, "JSONValidation", { enumerable: true, get: function () { return json_validation_js_1.JSONValidation; } });
Object.defineProperty(exports, "handleRefresh", { enumerable: true, get: function () { return json_validation_js_1.handleRefresh; } });
var json_hover_js_1 = require("./json-hover.js");
Object.defineProperty(exports, "jsonSchemaHover", { enumerable: true, get: function () { return json_hover_js_1.jsonSchemaHover; } });
Object.defineProperty(exports, "JSONHover", { enumerable: true, get: function () { return json_hover_js_1.JSONHover; } });
var bundled_js_1 = require("./bundled.js");

@@ -27,0 +30,0 @@ Object.defineProperty(exports, "jsonSchema", { enumerable: true, get: function () { return bundled_js_1.jsonSchema; } });

@@ -13,2 +13,3 @@ "use strict";

const parseJSON5Document_js_1 = require("./utils/parseJSON5Document.js");
const debug_js_1 = require("./utils/debug.js");
const getDefaultParser = (mode) => {

@@ -84,2 +85,3 @@ switch (mode) {

.replaceAll("in `#` ", "")
.replaceAll("at `#`", "")
.replaceAll("/", ".")

@@ -120,2 +122,3 @@ .replaceAll("#.", "");

catch (_a) { }
debug_js_1.debug.log("xxx", "validation errors", errors, json.data);
if (!errors.length)

@@ -125,3 +128,2 @@ return [];

return errors.reduce((acc, error) => {
var _a;
const pushRoot = () => {

@@ -144,6 +146,7 @@ const errorString = this.rewriteError(error);

const pointer = json.pointers.get(errorPath);
if ((_a = error.name === "MaxPropertiesError") !== null && _a !== void 0 ? _a : error.name === "MinPropertiesError") {
if (error.name === "MaxPropertiesError" ||
error.name === "MinPropertiesError") {
pushRoot();
}
if (pointer) {
else if (pointer) {
// if the error is a property error, use the key position

@@ -170,2 +173,5 @@ const isKeyError = positionalErrors.includes(error.name);

}
else {
pushRoot();
}
return acc;

@@ -172,0 +178,0 @@ }, []);

@@ -1,4 +0,4 @@

export { jsonCompletion } from "./json-completion.js";
export { jsonSchemaLinter, type JSONValidationOptions, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover.js";
export { jsonCompletion, JSONCompletion, type JSONCompletionOptions, } from "./json-completion.js";
export { jsonSchemaLinter, JSONValidation, type JSONValidationOptions, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, JSONHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover.js";
export { jsonSchema } from "./bundled.js";

@@ -5,0 +5,0 @@ export type { JSONPointersMap, JSONPointerData, JSONPartialPointerData, } from "./types.js";

@@ -1,4 +0,4 @@

export { jsonCompletion } from "./json-completion.js";
export { jsonSchemaLinter, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, } from "./json-hover.js";
export { jsonCompletion, JSONCompletion, } from "./json-completion.js";
export { jsonSchemaLinter, JSONValidation, handleRefresh, } from "./json-validation.js";
export { jsonSchemaHover, JSONHover, } from "./json-hover.js";
export { jsonSchema } from "./bundled.js";

@@ -5,0 +5,0 @@ export * from "./utils/parseJSONDocument.js";

@@ -10,2 +10,3 @@ import { Draft04 } from "json-schema-library";

import { parseJSON5DocumentState } from "./utils/parseJSON5Document.js";
import { debug } from "./utils/debug.js";
const getDefaultParser = (mode) => {

@@ -79,2 +80,3 @@ switch (mode) {

.replaceAll("in `#` ", "")
.replaceAll("at `#`", "")
.replaceAll("/", ".")

@@ -115,2 +117,3 @@ .replaceAll("#.", "");

catch (_a) { }
debug.log("xxx", "validation errors", errors, json.data);
if (!errors.length)

@@ -120,3 +123,2 @@ return [];

return errors.reduce((acc, error) => {
var _a;
const pushRoot = () => {

@@ -139,6 +141,7 @@ const errorString = this.rewriteError(error);

const pointer = json.pointers.get(errorPath);
if ((_a = error.name === "MaxPropertiesError") !== null && _a !== void 0 ? _a : error.name === "MinPropertiesError") {
if (error.name === "MaxPropertiesError" ||
error.name === "MinPropertiesError") {
pushRoot();
}
if (pointer) {
else if (pointer) {
// if the error is a property error, use the key position

@@ -165,2 +168,5 @@ const isKeyError = positionalErrors.includes(error.name);

}
else {
pushRoot();
}
return acc;

@@ -167,0 +173,0 @@ }, []);

@@ -45,3 +45,3 @@ [codemirror-json-schema](../README.md) / JSONValidationOptions

[json-validation.ts:43](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-validation.ts#L43)
[json-validation.ts:43](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-validation.ts#L43)

@@ -70,3 +70,3 @@ ## Properties

[json-validation.ts:42](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-validation.ts#L42)
[json-validation.ts:42](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-validation.ts#L42)

@@ -81,2 +81,2 @@ ---

[json-validation.ts:41](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-validation.ts#L41)
[json-validation.ts:41](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-validation.ts#L41)

@@ -24,2 +24,8 @@ codemirror-json-schema

### Classes
- [JSONCompletion](classes/JSONCompletion.md)
- [JSONHover](classes/JSONHover.md)
- [JSONValidation](classes/JSONValidation.md)
### Functions

@@ -36,2 +42,3 @@

- [JSONCompletionOptions](interfaces/JSONCompletionOptions.md)
- [JSONValidationOptions](interfaces/JSONValidationOptions.md)

@@ -72,3 +79,3 @@

[bundled.ts:15](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/bundled.ts#L15)
[bundled.ts:15](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/bundled.ts#L15)

@@ -87,3 +94,3 @@ ## Codemirror Extensions

| :------ | :------ |
| `opts` | `JSONCompletionOptions` |
| `opts` | [`JSONCompletionOptions`](interfaces/JSONCompletionOptions.md) |

@@ -108,3 +115,3 @@ #### Returns

[json-completion.ts:936](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-completion.ts#L936)
[json-completion.ts:936](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-completion.ts#L936)

@@ -145,3 +152,3 @@ ___

[json-hover.ts:45](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-hover.ts#L45)
[json-hover.ts:45](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-hover.ts#L45)

@@ -180,3 +187,3 @@ ___

[json-validation.ts:58](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-validation.ts#L58)
[json-validation.ts:58](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-validation.ts#L58)

@@ -204,3 +211,3 @@ ## Utilities

[utils/jsonPointers.ts:85](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/jsonPointers.ts#L85)
[utils/jsonPointers.ts:85](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/jsonPointers.ts#L85)

@@ -230,3 +237,3 @@ ___

[utils/jsonPointers.ts:68](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/jsonPointers.ts#L68)
[utils/jsonPointers.ts:68](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/jsonPointers.ts#L68)

@@ -258,3 +265,3 @@ ___

[utils/parseJSONDocument.ts:24](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/parseJSONDocument.ts#L24)
[utils/parseJSONDocument.ts:24](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/parseJSONDocument.ts#L24)

@@ -286,3 +293,3 @@ ___

[utils/parseJSONDocument.ts:10](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/parseJSONDocument.ts#L10)
[utils/parseJSONDocument.ts:10](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/parseJSONDocument.ts#L10)

@@ -307,3 +314,3 @@ ## Functions

[state.ts:25](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/state.ts#L25)
[state.ts:25](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/state.ts#L25)

@@ -330,3 +337,3 @@ ___

[utils/jsonPointers.ts:31](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/jsonPointers.ts#L31)
[utils/jsonPointers.ts:31](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/jsonPointers.ts#L31)

@@ -351,3 +358,3 @@ ___

[json-validation.ts:48](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-validation.ts#L48)
[json-validation.ts:48](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-validation.ts#L48)

@@ -373,3 +380,3 @@ ___

[utils/jsonPointers.ts:18](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/utils/jsonPointers.ts#L18)
[utils/jsonPointers.ts:18](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/utils/jsonPointers.ts#L18)

@@ -394,3 +401,3 @@ ___

[state.ts:29](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/state.ts#L29)
[state.ts:29](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/state.ts#L29)

@@ -416,3 +423,3 @@ ___

[state.ts:19](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/state.ts#L19)
[state.ts:19](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/state.ts#L19)

@@ -434,3 +441,3 @@ ## Type Aliases

[json-hover.ts:18](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-hover.ts#L18)
[json-hover.ts:18](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-hover.ts#L18)

@@ -445,3 +452,3 @@ ___

[json-hover.ts:20](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-hover.ts#L20)
[json-hover.ts:20](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-hover.ts#L20)

@@ -465,3 +472,3 @@ ___

[json-hover.ts:24](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/json-hover.ts#L24)
[json-hover.ts:24](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/json-hover.ts#L24)

@@ -483,3 +490,3 @@ ___

[types.ts:6](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/types.ts#L6)
[types.ts:6](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/types.ts#L6)

@@ -503,3 +510,3 @@ ___

[types.ts:11](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/types.ts#L11)
[types.ts:11](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/types.ts#L11)

@@ -514,3 +521,3 @@ ___

[types.ts:20](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/types.ts#L20)
[types.ts:20](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/types.ts#L20)

@@ -525,2 +532,2 @@ ## Variables

[state.ts:6](https://github.com/acao/codemirror-json-schema/blob/0dc3749/src/state.ts#L6)
[state.ts:6](https://github.com/acao/codemirror-json-schema/blob/da7f368/src/state.ts#L6)
{
"name": "codemirror-json-schema",
"license": "MIT",
"version": "0.7.2",
"version": "0.7.3",
"description": "Codemirror 6 extensions that provide full JSONSchema support for `@codemirror/lang-json` and `codemirror-json5`",

@@ -6,0 +6,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc