Skip to main content

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


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.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

directory_schema-0.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file directory_schema-0.0.1.tar.gz.

File metadata

  • Download URL: directory_schema-0.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for directory_schema-0.0.1.tar.gz
Algorithm Hash digest
SHA256 84bf891c333f090ef38f656eef04a8a8ed63c14b52965ed4e5bac3eba759a61b
MD5 dd19dad4b3d5986b513448273df35535
BLAKE2b-256 a2c3d9145dc1cf4815780262659be320a46f2e198be495f0c13b9ef7275af40c

See more details on using hashes here.

File details

Details for the file directory_schema-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: directory_schema-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for directory_schema-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73c2bb0bbeb525eba617338e49fd7f540e7709213999df2cc3d6fb8aebbcbee9
MD5 110618cbaebe118a22b22cd282acebc6
BLAKE2b-256 620897848bc0088c8f2eff77ce0d5d72650508ed0bc6ceeb8738e6c59188aba4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page