{"id":48874,"library":"pajv","title":"pajv - Polyglottal JSON Schema Validator","description":"pajv is a command-line JSON Schema validator that supports multiple data formats including CSON, Hjson, JSON5, TOML, and YAML, in addition to standard JSON. Version 1.2.0 is the latest stable release, built on top of Ajv (Another JSON Schema Validator) and any-json for format parsing. It provides a unified CLI interface for validating data files against JSON Schema, with features like referenced schemas, custom keywords, and error formatting. pajv is a fork of ajv-cli and extends its functionality to support polyglottal input formats. The project is actively maintained with regular updates.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/json-schema-everywhere/pajv","tags":["javascript","JSON","schema","validator","validation","jsonschema","json-schema","json-schema-validator","json-schema-validation"],"install":[{"cmd":"npm install pajv","lang":"bash","label":"npm"},{"cmd":"yarn add pajv","lang":"bash","label":"yarn"},{"cmd":"pnpm add pajv","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core validation engine; pajv uses Ajv for schema validation.","package":"ajv","optional":false},{"reason":"Parses multiple data formats (CSON, Hjson, JSON5, TOML, YAML) into JSON.","package":"any-json","optional":false}],"imports":[{"note":"pajv is a CLI tool, not a library. Do not attempt to import it programmatically; use child_process.spawn or shell commands instead.","wrong":"const pajv = require('pajv'); // pajv is not a JavaScript library, it's a CLI tool","symbol":"pajv CLI","correct":"Use the command line directly: pajv validate -s schema.json -d data.json"},{"note":"If you need programmatic validation, use the 'ajv' package directly. pajv is only for CLI usage.","wrong":"import pajv from 'pajv' // pajv does not export an Ajv instance","symbol":"Ajv (programmatic use)","correct":"import Ajv from 'ajv'"},{"note":"The global install is `npm install -g pajv`. Validate command can be omitted: `pajv -s schema.json -d data.json`.","wrong":"pajv -s schema.json -d data.yaml --errors json // valid but --errors option uses equals sign","symbol":"Validate via CLI","correct":"pajv validate -s schema.json -d data.yaml"}],"quickstart":{"code":"npm install -g pajv\n\n# Create a JSON schema file: schema.json\ncat > schema.json << EOF\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": { \"type\": \"string\" },\n    \"age\": { \"type\": \"number\" }\n  },\n  \"required\": [\"name\"]\n}\nEOF\n\n# Create a valid YAML data file: valid_data.yaml\necho \"name: John Doe\nage: 30\" > valid_data.yaml\n\n# Valid YAML against schema\npajv validate -s schema.json -d valid_data.yaml\n# Exit code 0, no output\n\n# Invalid data: missing required field 'name'\necho \"age: 25\" > invalid_data.yaml\npajv validate -s schema.json -d invalid_data.yaml\n# Exit code 1, prints error\n","lang":"bash","description":"Installs pajv globally and validates a YAML file against a JSON Schema, showing success vs failure."},"warnings":[{"fix":"Use child_process.spawn or exec to run pajv commands, or use the 'ajv' package directly for programmatic validation.","message":"pajv is a CLI tool, not a JavaScript library. Do not attempt to import it programmatically with require or import.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure data files have recognized extensions (.json, .yaml, .yml, .toml, .cson, .hjson, .json5) or use any-json directly.","message":"Schema file must be JSON or YAML; data files can be in CSON, Hjson, JSON, JSON5, TOML, or YAML. Using unsupported formats will throw an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use quotes: pajv -s schema.json -d \"test/*.json\"","message":"Glob patterns for -d and -r must be quoted in the shell to prevent expansion.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add --spec draft-04 or --spec draft-06 if needed. Note: pajv uses Ajv's default settings.","message":"As of Ajv v7, the default AJV schema draft is draft-07. Old schemas using draft-04 or draft-06 need explicit specification via --spec option.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Example: pajv -s schema.json -d data.json -c ./my-keywords.js or -c ajv-keywords","message":"Custom keywords via -c must export a function that accepts an Ajv instance. The file must have a leading dot-slash or be a package name.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.0':33 'activ':98 'addit':28 'ajv':43,84 'ajv-c':83 'anoth':44 'any-json':49 'built':39 'cli':59,85 'command':10 'command-lin':9 'cson':21 'custom':73 'data':18,63 'error':76 'extend':87 'featur':69 'file':64 'fork':81 'format':19,53,77,94 'function':89 'hjson':22 'includ':20 'input':93 'interfac':60 'javascript':103 'json':3,12,31,45,51,66,104,110,113,117 'json-schema':109 'json-schema-valid':112,116 'json5':23 'jsonschema':108 'keyword':74 'latest':36 'like':70 'line':11 'maintain':99 'multipl':17 'pajv':1,6,78 'pars':54 'polyglott':2,92 'project':96 'provid':56 'referenc':71 'regular':101 'releas':38 'schema':4,13,46,67,72,105,111,114,118 'stabl':37 'standard':30 'support':16,91 'toml':24 'top':41 'unifi':58 'updat':102 'valid':5,14,47,62,106,107,115,119 'version':32 'yaml':26","created_at":"2026-06-07T16:58:54.442570+00:00","updated_at":"2026-06-07T16:58:54.442570+00:00","problems":[{"fix":"Run `npm install -g pajv` and ensure npm global bin directory is in your PATH.","cause":"pajv is not installed or not in PATH.","error":"pajv: command not found"},{"fix":"Run `npm install -g pajv` again to ensure dependencies are installed.","cause":"Missing Ajv dependency when using custom keywords or if pajv installation is broken.","error":"Error: Cannot find module 'ajv'"},{"fix":"Ensure data matches schema type constraints. Example schema: { \"type\": \"string\" }","cause":"Schema expects a string but data provides a number or other type.","error":"data_path: should be string"},{"fix":"Check file paths and use absolute or correct relative paths. Use -s ./schema.json if needed.","cause":"Specified schema or data file does not exist.","error":"ENOENT: no such file or directory"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/json-schema-everywhere/pajv#readme","github":"https://github.com/json-schema-everywhere/pajv","docs":null,"changelog":null,"pypi":null,"npm":"pajv","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}