- Update vendored schemas (2022-06-01)
- Add support for TOML instance files using
tomli. See documentation on optional parsers for details. Thanks to @mondeja for the request and test data! - Instance files are now read in binary mode, not UTF-8 encoded
- The behavior of format checkers is now more draft-specific, as
check-jsonschemawill now use the appropriate checker for athe schema's draft as detected via the$schemaattribute
- Update vendored schemas: bamboo-spec, dependabot, github-actions, github-workflows, gitlab-ci, readthedocs, renovate, travis (2022-05-26)
- Add
check-dependabotto supported hooks
- Update vendored schemas: renovate, gitlab, github-workflow, github-actions, azure-pipelines, readthedocs (2022-05-13)
- Use
clickto implement CLI parsing. This provides several internal features as well as shell completion support. - Add support for
--versionas an option - Add support for the
NO_COLOR=1 - When loading schema references, check for a suffix of
.ya?mland emit a warning. This does not abort loading the reference. - When loading YAML instance files, non-string object keys will be stringified. This makes YAML data better conform to the requirements for JSON Schema.
- Change usage of stderr/stdout to send more of the error information to stdout and more of the user-messaging to stderr
- Deprecate
--show-all-validation-errors. It will be removed in a future release. - Add
-v/--verboseand-o/--output-formatto offer better control over output.--verbosereplaces--show-all-validation-errorsand-ocan be used to request JSON output as in-o JSON.
- Update vendored schemas: renovate, gitlab-ci (2022-04-13)
check-jsonschemanow treats all instance files as UTF-8, regardless of the platform and locale. This ensures that files are handled uniformly between *nix and Windows
- Update vendored schemas: renovate, github-workflows, gitlab-ci (2022-03-30)
- Fix the vendored schema for GitLab to pull from the correct location. Thanks @dsch for the fix!
- Update vendored schemas: azure-pipelines, renovate (2022-03-17)
- Allow invocation via
python -m check_jsonschema
- Drop support for python3.6 and improve internal type annotations
- Update vendored schemas (2022-02-28)
- Improve handling of file-URI inputs on Windows
- Add support for a new hook,
check-metaschema, which invokescheck-jsonschema --check-metaschema - The
check-jsonschemarepo has moved to a new home at https://github.com/python-jsonschema/check-jsonschema
- Add support for
--check-metaschema, which validates each instance file as a JSON Schema, using the metaschema specified by"$schema" --builtin-schemanow validates its arguments (withchoices=...), and its options are automatically picked up from the internal schema catalog and listed in the--helpoutput
- Add support for JSON5 files when
pyjson5orjson5is installed, and update the Renovate hook to list JSON5 config files. If a JSON5 file is checked without one of the necessary packages installed, a special error with installation instructions will be raised - Add hooks for GitLab CI and Bamboo Specs
- Remove the
--failover-builtin-schemabehavior. Now that vendored schemas are used by default for hooks, this option had very limited utility. - Update vendored schemas (2022-02-16)
- Add support for
--data-transform azure-pipelinesto handle compile-time expressions in Pipelines files. This option is applied to the azure pipelines hook (#29) - Improve handing of validation errors from schemas with
anyOfandoneOfclauses. Show the "best match" from underlying errors, and add an option--show-all-validation-errorswhich displays all of the underlying errors - Use vendored schemas in all hooks, not latest schemastore copies. This ensures that hook behavior is consistent (#38)
- Update vendored schemas (2022-02-12)
- Use
requeststo make HTTP requests, and retry request failures
- Fix the
check-renovatehook, which was skipping all files. Do not attempt to check JSON5 files, which are not supported. Thanks to @tpansino for the contribution! - Update vendored schema versions (2022-02-01)
- Use pypa's
buildtool to build dists - Update vendored schema versions (2022-01-27)
- Support YAML as a format for schema files (local schemas only). Thanks to @yyuu for the contribution!
- Update Azure Pipelines and ReadTheDocs hooks to always download latest schemas (rather than specific versions). This is safe now that they can failover to builtin schemas
- Update Azure Pipelines schema to latest
- Format checking now has special handling for the
regexformat. The default looks for recognizable syntaxes which indicate the use of an engine-specific regex feature which cannot be parsed in python. Such regexes are always treated as valid. To get strict python behavior (the previous behavior), use--format-regex=python. For no regex checking at all, without disabling other formats, use--format-regex=disabled. resolves #20 - Add a hook for Renovate Bot config,
check-renovate. Note that the hook does not support config inpackage.json(all other configuration locations are supported)
- Add ReadTheDocs hook
- Bugfix for package metadata to include builtin schemas
check-jsonschemanow ships with vendored versions of the external schemas used for the default suite of hooks. The vendored schemas are used as a failover option in the event that downloading an external schema fails. This resolves #21- New CLI options,
--builtin-schemaand--failover-builtin-schemaare available to access the builtin schemas. See documentation for details. - Use the latest version (version 4) of the
jsonschemalibrary. Note thatjsonschemahas dropped support for python3.6, andcheck-jsonschemawill therefore usejsonschemaversion 3 when running on python3.6 - The path shown in error messages is now a valid JSONPath expression
- Bugfix: validation errors were not being displayed correctly.
- Errors are now sent to stderr instead of stdout.
- Exception tracebacks for several known-cases are printed in a shortened
format. A new option,
--traceback-modecan be used to request long traces, as in--traceback-mode full - For schemas which do not include
$id, the schema URI will be used for$refresolution. This applies to HTTP(S) schema URI as well as to local paths. Thanks to @dkolepp for the bug report and contributions!
- Add support for string format verification, by enabling use of the
jsonschema.FormatChecker. This is enabled by default, but can be disabled with the--disable-formatflag
- Improved error output when the schema itself is invalid, either because it is not JSON or because it does not validate under its relevant metaschema
-
Added the
--default-filetypeflag, which sets a default of JSON or YAML loading to use whenidentifydoes not detect the filetype of an instance file. Defaults to failure on extensionless files. -
Schemafiles are now passed through
os.path.expanduser, meaning that a schema path of~/myschema.jsonwill be expanded by check-jsonschema itself (#9) -
Performance enhancement for testing many files: only load the schema once
-
Added
--no-cacheoption to disable schema caching -
Change the default schema download cache directory from
jsonschema_validatetocheck_jsonschema/downloads. e.g.~/.cache/jsonschema_validateis now~/.cache/check_jsonschema/downloads. Caches will now be in the following locations for different platforms and environments:$XDG_CACHE_HOME/check_jsonschema/downloads(Linux/other, XDG cache dir)~/.cache/check_jsonschema/downloads(Linux/other, no XDG cache dir set)~/Library/Caches/check_jsonschema/downloads(macOS)%LOCALAPPDATA%\check_jsonschema\downloads(Windows, local app data set)%APPDATA%\check_jsonschema\downloads(Windows, no local app data set, but appdata set)
- Update the azure-pipelines schema version to latest. Thanks to @Borda
- Fix a bug with parallel runs writing the same file in an unsafe way
- Update the base cache directory on macOS to
~/Library/Caches/. Thanks to @foolioo
- Bugfix: handle last-modified header being un-set on schema request. Thanks to @foolioo for the fix!
- Bugfix: handle non-string elements in the json path. Thanks to @Jean-MichelBenoit for the fix!
- Don't show full schemas on errors. Show only the filename, path, and message
- Convert from package to single module layout
- Add hooks for additional CI systems: Azure pipelines, GitHub Actions, and Travis
- Add
check-github-workflowshook
- Set min pre-commit version
- Initial version