jMatch
jMatch is a testsuite for JSON/YAML files. It allows you to check these
files against a specification based on defined patterns. This is useful if you
need to check lots of JSON files or if you want to check your JSON files in a
continuous integration pipeline.
Table of Contents
Installation
Install via PIP
Make sure, you have python3 with pip installed. Use pip to install jMatch
in your shell as follows:
pip install jmatch
Usage
As soon as jMatch is installed, it is used to check JSON/YAML documents
against a predefined specification. jMatch uses JSON/YAML to define
specification options as a search pattern.
Example Specification Pattern
Example usecase: Imagine, a bunch of JSON-formated config files, all of those config files should specify the same text-encoding (UTF-8) to make sure that all systems interoperate correctly.
Solution: To implement a solution for the given usecase, another JSON-document needs to be specified, which contains at least the following data concerning the given problem.
- type:
infoorerror - message: A message to print if the pattern matches
- pattern: An info or error case pattern that is searched in the document to check.
[{
"_type": "error",
"_message": "The encoding should be UTF-8, but it is not.",
"_pattern": {
"encoding": {"_not": "UTF-8"}
}
}]
We want to mark the problem as critical, we use the error type. If used in a
CI-pipeline, the type error forces the Pipeline to fail, if the pattern
matches. For the pattern we want to search for a encoding, with a value
different from UTF-8.
Check if the pattern exists in a JSON document
If we want to check a configfile.json file if it matches our
check-encoding-utf8.json. We can perform the following operation, assuming
that both files are in our current working directory:
jmatch --target configfile.json check-encoding-utf8.json
If the configfile contains the pattern specified in check-encoding-utf8.json, the
_message specified is displayed.
Check for multiple patterns at once
jMatch allows to check many patterns at once, therefore all pattern files must be provided when running jMatch.
jmatch --target configfile.json pattern1.json pattern2.json [...]
To provide multiple pattern files for jMatch, wildcard expressions can be used, to specify many pattern files easily:
jmatch --target hello.json pattern*.json
Flags
There are many different flags which change jMatchs default behavior. You can
use the --help flag to show all available options.
Support
Please open an issue for support.
Metadata
Release files for jmatch 0.4
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 |
|---|---|---|---|---|
| jmatch-0.4.tar.gz | 11.4 kB | Without provenance | Details for jmatch-0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jmatch-0.4-py3-none-any.whl | Python 3 | none | any | Details for jmatch-0.4-py3-none-any.whl |
Total release size: 16.3 kB
Release files / jmatch-0.4.tar.gz
| Download URL | jmatch-0.4.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
042cda5fafbbd8633d4d9d6a6f41dfa8e776d62c065b3d6d212e9f3140263f8a
|
|
BLAKE2b-256 checksum How to use checksums |
71d9d6147c3d5435dad472fe2dfb554178a557f7d6f5fd8d8b8d0075398f9d2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
|
Release files / jmatch-0.4-py3-none-any.whl
| Download URL | jmatch-0.4-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a24ea0dbdbd9bce1d426e088e962a6d1d857226e7d74975f18b54ddbbe5f0f30
|
|
BLAKE2b-256 checksum How to use checksums |
b941ca657fb02cb1b5e01a415b7833cc3ad9f8ecfe88c683a897372755f6985f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
|
Security for jmatch 0.4
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.