Skip to main content

Use JSON Schema to validate directory structures

Project description



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.


$ 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


>>> 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:

fails this "pattern" check:


Thank you

This package was created with Cookiecutter and the cs01/cookiecutter-pypackage project template.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for directory-schema, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size directory_schema-0.0.2-py3-none-any.whl (6.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size directory_schema-0.0.2.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page