Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
codemirror-json-schema
Advanced tools
A JSONSchema enabled mode for codemirror 6, for both json4 and json5, inspired by monaco-json
Codemirror extensions that add on @codemirror/lang-json
's and codemirror-json5
's grammars to add JSONSchema support!
It's at a very early stage, but usable.
lint
s: validates json against schemahint
s: provides code completion (no complex types yet)info
s: provides hover tooltiplint
s: validates json against schemainfo
s: provides hover tooltipTo give you as much flexibility as possible, everything codemirror related is a peer or optional dependency
Based on whether you want to support json4, json5 or both, you will need to install the relevant language mode for our library to use.
with auto-install-peers true
or similar:
npm install --save @codemirror/lang-json codemirror-json-schema
without auto-install-peers true
:
npm install --save @codemirror/lang-json codemirror-json-schema @codemirror/language @codemirror/lint @codemirror/view @codemirror/state @lezer/common
import { EditorState } from "@codemirror/state";
import { linter } from "@codemirror/lint";
import { json, jsonParseLinter } from "@codemirror/lang-json";
import { jsonSchemaLinter, jsonSchemaHover } from "codemirror-json-schema";
const schema = {
type: "object",
properties: {
example: {
type: "boolean",
},
},
};
const state = EditorState.create({
doc: `{ "example": true }`,
extensions: [
json(),
linter(jsonParseLinter()),
linter(jsonSchemaLinter(schema)),
jsonLanguage.data.of({
autocomplete: jsonCompletion(schema),
}),
hoverTooltip(jsonSchemaHover(schema)),
];
})
with auto-install-peers true
or similar:
npm install --save codemirror-json5 codemirror-json-schema
without auto-install-peers true
:
npm install --save codemirror-json5 codemirror-json-schema @codemirror/language @codemirror/lint @codemirror/view @codemirror/state @lezer/common
import { EditorState } from "@codemirror/state";
import { linter } from "@codemirror/lint";
import { json5, json5ParseLinter } from "codemirror-json5";
import {
json5SchemaLinter,
json5SchemaHover,
} from "codemirror-json-schema/json5";
const schema = {
type: "object",
properties: {
example: {
type: "boolean",
},
},
};
const json5State = EditorState.create({
doc: `{ example: true }`,
extensions: [
json5(),
linter(json5ParseLinter()),
linter(json5SchemaLinter(schema)),
hoverTooltip(json5SchemaHover(schema)),
],
});
You can start with the deployed example to see a more comprehensive setup.
For more information, see the API Docs
oneOf
, anyOf
, allOf
and other schema combination methodsmonaco-json
and monaco-yaml
both provide these features, and I want the nascent codemirror 6 to have them as well!
also, json5 is slowly growing in usage, and it needs full language support!
cm6-graphql
, ala monaco-graphql
0.2.1
FAQs
Codemirror 6 extensions that provide full JSONSchema support for `@codemirror/lang-json` and `codemirror-json5`
The npm package codemirror-json-schema receives a total of 15,705 weekly downloads. As such, codemirror-json-schema popularity was classified as popular.
We found that codemirror-json-schema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.