perfect-jsonschema
Because soft validation is not enough
Why
JSON schema standard and its implementations stand that if you have something unfamiliar in your schema, it's not an error. In particular, you won't get an error if you made a typo or used something you thought as working. For example, this one is perfectly fine and valid:
{
"required": ["company"],
"type": "object",
"propertie": {"company": {"pattern": "^(Apple)$"}, "format": "url"},
}
But we want to catch those propertie typos and invalid url formats.
The library rely on jsonschema and supports additional keywords to ignore.
Features
Derives the draft from the schema and yields a jsonschema.SchemaError if:
- A schema is empty
- A schema contains a keyword which is not a part of a jsonschema implementation or
extended_keywordsset - A schema contains an invalid format value
- A schema fails with
jsonschema.check_schema()
Usage
from perfect-jsonschema import check
try:
check(schema, extended_keywords={"tag"})
except Exception as e:
do_something()
An exception example:
Traceback (most recent call last):
f"Schema contains invalid keywords for "
jsonschema.exceptions.SchemaError: Schema contains invalid keywords for http://json-schema.org/draft-07/schema#:
{'propertie', 'company'}
Local development
pipenv install --dev
pipenv shell
tox
Contribution
Any contribution is welcome
Metadata
Release files for perfect-jsonschema 2019.2.6
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 |
|---|---|---|---|---|
| perfect-jsonschema-2019.2.6.tar.gz | 11.7 kB | Without provenance | Details for perfect-jsonschema-2019.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| perfect_jsonschema-2019.2.6-py3-none-any.whl | Python 3 | none | any | Details for perfect_jsonschema-2019.2.6-py3-none-any.whl |
Total release size: 16.2 kB
Release files / perfect-jsonschema-2019.2.6.tar.gz
| Download URL | perfect-jsonschema-2019.2.6.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
441877f9a9ec32716715acc13b5c28f79a34f98f0823178b2d992fa95526bc00
|
|
BLAKE2b-256 checksum How to use checksums |
987e1c6c39297d09363e88d53e9d805f0cf1bb39dde67a69801d162529b28207
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.2
|
Release files / perfect_jsonschema-2019.2.6-py3-none-any.whl
| Download URL | perfect_jsonschema-2019.2.6-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0dbb049a48eaa1636cacdd6119fd8e6425561fa7f9b028e926774b26517d7aa4
|
|
BLAKE2b-256 checksum How to use checksums |
eac1de9bb485f2d7cf7e11ef27a291a80cf31fcc76db59e864d89f21333f656e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.2
|
Security for perfect-jsonschema 2019.2.6
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.