jps-yaml-schema-validator
A strict, rule-driven YAML validator that verifies configuration files against a YAML-defined schema — supporting rich type checking, required fields, filesystem validation, enumerations, regex constraints, numeric ranges, list validation, and complete aggregated error reporting.
🚀 Overview
jps-yaml-schema-validator enables configuration-driven applications to validate user-supplied YAML files using a declarative rules file (also YAML).
This library focuses on:
- Strict validation (no silently ignored fields)
- Rich semantic checks
- Human-readable error messages
- Aggregated error reporting (never fail fast)
- CLI + Python API support
Ideal for pipelines, workflow engines (Nextflow/Snakemake), microservices, CLIs, or any software that consumes YAML config files.
✨ Features
Supported rule types
| Rule | Description |
|---|---|
required: true |
Field must exist |
type: string/int/float/bool |
Type enforcement |
type: file |
File must exist, readable, and not empty |
type: directory |
Must be an existing absolute directory |
allowed: [...] |
Enumerations |
regex: "pattern" |
Regex string validation |
min_length, max_length |
String length constraints |
min, max |
Numeric range checks |
element_type, min_items |
List validation |
allow_extra_keys |
Disable/enable acceptance of unknown keys |
Additional capabilities
- Aggregates all validation errors before failing
- Validates the schema file itself
- Robust error messages
- Clear CLI interface
- 100% deterministic behavior
📘 Example
rules.yaml
name:
type: string
required: true
threads:
type: int
required: true
min: 1
max: 64
input_file:
type: file
required: true
mode:
type: string
allowed:
- fast
- slow
config.yaml
name: "my job"
threads: 12
input_file: input.txt
mode: fast
Validate using CLI
jps-yaml-schema-validate validate \
--schema rules.yaml \
--config config.yaml
Output:
✅ Configuration is valid.
❌ Example validation failures
If the user config violates rules:
❌ Validation failed:
- Missing required key: name
- Field 'threads' must be >= 1
- Field 'input_file' must be an existing file
🧨 CLI Usage
jps-yaml-schema-validate validate --schema rules.yaml --config config.yaml
Full help:
jps-yaml-schema-validate --help
🧵 Python API Usage
from jps_yaml_schema_validator import assert_valid_config
schema = {
"name": {"type": "string", "required": True},
"threads": {"type": "int", "min": 1, "max": 16},
}
config = {"name": "job1", "threads": 8}
assert_valid_config(schema=schema, config=config)
📦 Installation
From source
make install
From PyPI
pip install jps-yaml-schema-validator
🧪 Development
make fix && make format && make lint
make test
To run tests with coverage:
make test
📜 License
MIT License © Jaideep Sundaram
Metadata
Release files for jps-yaml-schema-validator 1.0.2
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 |
|---|---|---|---|---|
| jps_yaml_schema_validator-1.0.2.tar.gz | 14.2 kB | Without provenance | Details for jps_yaml_schema_validator-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jps_yaml_schema_validator-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for jps_yaml_schema_validator-1.0.2-py3-none-any.whl |
Total release size: 24.2 kB
Release files / jps_yaml_schema_validator-1.0.2.tar.gz
| Download URL | jps_yaml_schema_validator-1.0.2.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40b083ab9fac4c6ef58ecd6369d572746534af2e6f539c2bdad3b10bbab2e5e7
|
|
BLAKE2b-256 checksum How to use checksums |
b3f521c17b5fac19d74edf759b7f3dce590a5ec5750432c39ce21c15f1e427c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / jps_yaml_schema_validator-1.0.2-py3-none-any.whl
| Download URL | jps_yaml_schema_validator-1.0.2-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c21d2a489d9923d505ac28b96512203ca308eaea81a4e00d76cdadc719d0289
|
|
BLAKE2b-256 checksum How to use checksums |
0585da2ae32eb674f4121fec04e5d59f63d67c6d64285102a2d40cf69fa9ae89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for jps-yaml-schema-validator 1.0.2
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.