Registry / devops / meta-json-schema

meta-json-schema

JSON →
library1.19.26jsnpmunverified

JSON Schema collection for Clash Meta (Mihomo) configuration files, providing autocompletion, validation, and documentation in editors like VS Code and Monaco. Current stable version is 1.19.26, released frequently on npm. Additionally includes schemas for Clash Verge and Clash Nyanpasu merge configs. Differentiator: official schema for the Clash Meta ecosystem, supporting draft-07, unpkg hosting, and modeline usage.

npm install meta-json-schema
INSTALL
IMPORT
SIG · META-JSON-SCHEMA
M
meta-json-schema
devopsjavascriptv1.19.26
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

meta-json-schema (schema URL)
https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json
https://cdn.jsdelivr.net/npm/meta-json-schema/schemas/meta-json-schema.json
Use unpkg URL; jsdelivr may serve different content or have stale cache.
configureMonacoYaml
import { configureMonacoYaml } from 'monaco-yaml';
const configureMonacoYaml = require('monaco-yaml');
monaco-yaml is ESM-only; CommonJS require will fail.
Schema usage in VS Code settings.json
"yaml.schemas": {"https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json": "**/*.yaml"}
"yaml.schemas": {"https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json": ["*.yaml"]}
Value must be a string (glob pattern) or array of strings, but common mistake is using an array without proper syntax.

Shows how to enable Meta JSON Schema in VS Code and Monaco Editor for YAML validation.

// 1. In VS Code settings.json: { "yaml.schemas": { "https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json": "**/*.yaml" } } // 2. Or add a modeline at the top of your YAML file: # yaml-language-server: $schema=https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json mode: rule // 3. For Monaco Editor: import * as monaco from 'monaco-editor'; import { configureMonacoYaml } from 'monaco-yaml'; configureMonacoYaml(monaco, { validate: true, enableSchemaRequest: true, schemas: [ { uri: 'https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json', fileMatch: ['**/*.clash.yaml'] } ] });
Debug
Known issues
breakingNode.js >=22 is required. Older versions will fail to run the build scripts.
fix
Update Node.js to v22 or later.
affects: <22
deprecatedThe schema URL may change between major versions; pin to a specific version in production to avoid unexpected schema changes.
fix
Use versioned URLs like https://unpkg.com/meta-json-schema@1.19.26/schemas/meta-json-schema.json
affects: >=1.0
gotchaThe package is ESM-only; require() will throw an error if you try to use it programmatically in CommonJS.
fix
Use dynamic import() or switch to ESM.
affects: >=1.0
gotchaThe schema is hosted on unpkg; network requests are required. Offline usage or air-gapped environments will fail unless you self-host the schema.
fix
Download the schema file and reference it locally, e.g., file:///path/to/meta-json-schema.json.
affects: >=1.0
gotchaThe schema references draft-07; some features from newer drafts (e.g., if/then/else from 2019-09) are not supported.
fix
Ensure your YAML adheres to draft-07 constraints.
affects: >=1.0
Errors
Common errors & fixes
Cannot find module 'monaco-yaml' or its corresponding type declarations.
monaco-yaml is not installed or not declared in tsconfig.json
fix
npm install monaco-yaml; add 'monaco-yaml' to 'types' in tsconfig.json or use 'declare module'.
Request failed with status code 404 for https://unpkg.com/meta-json-schema/schemas/meta-json-schema.json
Typo in schema URL or using a version that doesn't exist
fix
Double-check the URL; use exact version like https://unpkg.com/meta-json-schema@1.19.26/schemas/meta-json-schema.json
The document is not valid YAML. Reason: unknown tag '!<tag:yaml.org,2002:...'
YAML file contains custom tags not supported by the schema
fix
Remove custom YAML tags or disable validation for those lines.
Property mode is not allowed. (yaml-schema: meta-json-schema.json)
Using a property that is not in the schema; schema version mismatch
fix
Ensure the schema matches your Clash Meta version; pin schema version to your Clash Meta version.
Upgrade
Version history
1.19.26latest on npm
Audit
Dependencies
monaco-editoroptionalRequired when using Monaco Editor integration via monaco-yaml.
monaco-yamloptionalYAML language support for Monaco Editor; needed to configure the schema.
vite-plugin-monaco-editoroptionalVite plugin to bundle Monaco workers; simplifies setup for Vite projects.
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
meta-json-schema — npm install meta-json-schema · libregistry