jsonschema-lint
Linter for JSON Schema instances.
Installation
This project is not currently packaged and so must be installed manually.
Clone the project with the following command:
git clone https://github.com/jacksmith15/jsonschema-lint.git
Usage
The linter is invoked on the command line:
$ jsonschema-lint
Selecting instances
By default, the linter will attempt to lint every file matching extension under the currect directory. This means every .json file, plus every .yaml/.yml file if PyYAML is installed. A file will only be linted if a matching schema can be detected (see below).
You can override this behaviour by passing arguments to the linter, e.g.
$ jsonschema-lint **/*.avsc
Schema resolution
There are three ways schemas can be selected for a given instance. In order of priority:
- If provided, the
--schemaoption will be used to validate all target instances. - A matching rule in a
.jsonschema-lintfile, in the instance directory or its parents (see below). - If the
--schema-storeflag is provided, then matching rules from Schema Store will be used.
.jsonschema-lint files
.jsonschema-lint files follow similar logic to .gitignore and Github CODEOWNERS files, in that they apply to all files under their directory tree.
Each line in a .jsonschema-lint file is a rule, matching a filepath pattern to a particular schema. For example:
**/.circleci/config.yml https://json.schemastore.org/circleciconfig.json yaml
There are three parts to each rule, separated by whitespace. These are:
- the pattern/glob, in this case matching any files named
config.ymlin a directory named.circleci - the location of the schema. This can be a remote URL, or a path on the local filesystem. If this is a relative path, it is resolved relative to the
.jsonschema-lintfile. - (optional) the expected file format of any instances. If this is omitted, the linter will attempt to detect the correct type from the file extension. If it cannot be detected, both will be attempted.
Development
Install dependencies:
pyenv shell 3.9.4 # Or other 3.9.x
pre-commit install # Configure commit hooks
poetry install # Install Python dependencies
Run tests:
poetry run inv verify
License
This project is distributed under the MIT license.
Metadata
Release files for jsonschema-lint 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsonschema-lint-0.1.0.tar.gz | 14.5 kB | Without provenance | Details for jsonschema-lint-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsonschema_lint-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for jsonschema_lint-0.1.0-py3-none-any.whl |
Total release size: 32.9 kB
Release files / jsonschema-lint-0.1.0.tar.gz
| Download URL | jsonschema-lint-0.1.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2626105694550a5c40e2f55d6d20fd49d5a886df7130ba78f913590fcd7317c9
|
|
BLAKE2b-256 checksum How to use checksums |
584c0166551d5aa74e48e80d3ce53dc04332fe3d6d39faafc87435caf22b635b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.8.6 Linux/5.8.0-63-generic
|
Release files / jsonschema_lint-0.1.0-py3-none-any.whl
| Download URL | jsonschema_lint-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
274a1abc82b0274d4b2be0f3fea9a091d723239e3271ec5aed86e640c9ab64e4
|
|
BLAKE2b-256 checksum How to use checksums |
bec379e40253c199ba2a9f97bb38ec7896618399b412091e8e2ac4ab1c6fd353
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.8.6 Linux/5.8.0-63-generic
|
Security for jsonschema-lint 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.