Use JSON Schema to validate directory structures
Project description
directory_schema
Use JSON Schema to validate directory structures:
The specified directory is translated into a JSON structure like the output from tree -J
,
and is validated against a JSON Schema, provided as a dict inside Python,
or as a JSON or YAML file through the CLI.
Sample schemas and directories are in the test fixtures.
Instructions for contributors are here.
CLI
$ directory_schema -h
usage: directory_schema [-h] DIRECTORY SCHEMA
positional arguments:
DIRECTORY Directory to validate
SCHEMA Schema (JSON or YAML) to validate against
optional arguments:
-h, --help show this help message and exit
Python
>>> from directory_schema import directory_schema
>>> directory_schema.validate_dir(
... 'tests/fixtures/just-a-placeholder',
... {'items':
... {'properties':
... {'name':
... {'pattern': 'not-placeholder'}}}}
... )
Traceback (most recent call last):
...
raise DirectoryValidationErrors(errors)
directory_schema.directory_schema.DirectoryValidationErrors: This string:
placeholder
fails this "pattern" check:
not-placeholder
...
Thank you
This package was created with Cookiecutter and the cs01/cookiecutter-pypackage
project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
directory_schema-0.0.2.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for directory_schema-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e6b6a26a0c820740f1996cab70dc578b413c7c223eceb13a987a913a2956aa1 |
|
MD5 | c23f794eb6f99bd53d78740fcffaebf6 |
|
BLAKE2b-256 | 7c96ca69e89cd52b10befadd8433fd56dd8863c055655045a76cbfd6da74bc89 |