v8r
v8r is a command-line validator for JSON, YAML, and TOML files that automatically detects and applies appropriate schemas from the Schema Store based on filename patterns, providing intelligent validation without manual schema configuration.
Key Features:
- Automatic Schema Detection: Uses Schema Store to intelligently match files with appropriate schemas based on filename patterns
- Multi-Format Support: Validates JSON, YAML, and TOML files with consistent interface across formats
- Zero Configuration: Works out-of-the-box for common configuration files without requiring explicit schema specification
- Schema Store Integration: Leverages the extensive collection of schemas from schemastore.org for popular tools and frameworks
- Detailed Error Reporting: Provides clear, actionable validation error messages with line and column information
v8r documentation
- Version in MegaLinter: 5.0.0
- Visit Official Web Site
- See Index of problems detected by v8r
Configuration in MegaLinter
- Enable v8r by adding
JSON_V8R
in ENABLE_LINTERS variable - Disable v8r by adding
JSON_V8R
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
JSON_V8R_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
JSON_V8R_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter Ex: -s --foo "bar" |
|
JSON_V8R_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
JSON_V8R_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
JSON_V8R_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- list_of_files : Call the linter with the list of files as argument- project : Call the linter from the root of the project |
list_of_files |
JSON_V8R_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".json"] |
JSON_V8R_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
Include every file |
JSON_V8R_PRE_COMMANDS | List of bash commands to run before the linter | None |
JSON_V8R_POST_COMMANDS | List of bash commands to run after the linter | None |
JSON_V8R_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling JSON_V8R and its pre/post commands | None |
JSON_V8R_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
JSON_V8R_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
JSON_V8R_CLI_EXECUTABLE | Override CLI executable | ['v8r'] |
IDE Integration
Use v8r in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Eclipse | native support | Visit Web Site | |
IDEA | native support | Visit Web Site | |
vim | vison | Visit Web Site | |
Visual Studio Code | native support | Visit Web Site |
MegaLinter Flavors
This linter is available in the following flavors
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
![]() |
all | Default MegaLinter Flavor | 126 | |
c_cpp | Optimized for pure C/C++ projects | 56 | ||
ci_light | Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML | 22 | ||
cupcake | MegaLinter for the most commonly used languages | 87 | ||
documentation | MegaLinter for documentation projects | 49 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 64 | ||
dotnetweb | Optimized for C, C++, C# or VB based projects with JS/TS | 73 | ||
go | Optimized for GO based projects | 51 | ||
java | Optimized for JAVA based projects | 54 | ||
javascript | Optimized for JAVASCRIPT or TYPESCRIPT based projects | 59 | ||
php | Optimized for PHP based projects | 54 | ||
python | Optimized for PYTHON based projects | 65 | ||
ruby | Optimized for RUBY based projects | 50 | ||
rust | Optimized for RUST based projects | 50 | ||
salesforce | Optimized for Salesforce based projects | 54 | ||
swift | Optimized for SWIFT based projects | 50 | ||
terraform | Optimized for TERRAFORM based projects | 54 |
Behind the scenes
How are identified applicable files
- File extensions:
.json
How the linting is performed
- v8r is called once with the list of files as arguments (
list_of_files
CLI lint mode)
Example calls
v8r --ignore-errors myfile.json
Help content
ℹ No config file found
v8r <patterns..>
Validate local json/json5/toml/yaml files against schema(s)
Positionals:
patterns One or more filenames or glob patterns describing local file or file
s to validate
Options:
--help Show help [boolean]
--version Show version number [boolean]
-v, --verbose Run with verbose logging. Can be stacked e.g: -vv
-vvv [count]
-s, --schema Local path or URL of a schema to validate against.
If not supplied, we will attempt to find an appro
priate schema on schemastore.org using the filenam
e. If passed with glob pattern(s) matching multipl
e files, all matching files will be validated agai
nst this schema [string]
-c, --catalogs A list of local paths or URLs of custom catalogs t
o use prior to schemastore.org [array]
--ignore-errors Exit with code 0 even if an error was encountered.
Passing this flag means a non-zero exit code is o
nly issued if validation could be completed succes
sfully and one or more files were invalid
[boolean] [default: false]
--ignore-pattern-files A list of files containing glob patterns to ignore
[array] [default: [".v8rignore",".gitignore"]]
--no-ignore Disable all ignore files [boolean]
--cache-ttl Remove cached HTTP responses older than <cache-ttl
> seconds old. Passing 0 clears and disables cache
completely [number] [default: 600]
--output-format Output format for validation results
[string] [choices: "text", "json"] [default: "text"]
Examples:
v8r file.json Validate a single file
v8r file1.json file2.json Validate multiple files
v8r 'dir/*.yml' 'dir/*.yaml' Specify files to validate with glob patterns
Installation on mega-linter Docker image
- Dockerfile commands :
# renovate: datasource=npm depName=v8r
ARG NPM_V8R_VERSION=5.0.0
- NPM packages (node.js):