Skip to main content

A CLI and pre-commit hooks for jsonschema validation in YAML files with multiple documents

Project description

check-yamlschema

A CLI and pre-commit hook for jsonschema validation in YAML files with multiple documents

Parse multi-documents YAML files, look for inline schema comments, and validate the documents according to their schema.

The inline schema comments should use the following format:

# yaml-language-server: $schema=<schema_url>
food: # Some YAML document
  - vegetables: tomatoes
  - fruits:
      citrics: oranges
      tropical: bananas
      nuts: peanuts
      sweets: raisins
---
# yaml-language-server: $schema=<another_schema_url
name: Martin Devloper # Some other YAML document
age: 26
hobbies:
  - painting
  - playing_music
  - cooking
programming_languages:
  java: Intermediate
  python: Advanced
  javascript: Beginner
favorite_food:
  - vegetables: tomatoes
  - fruits:
      citrics: oranges
      tropical: bananas
      nuts: peanuts
      sweets: raisins

CLI usage

  • Install it with pip install check-yamlschema
  • Run it with some YAML files in parameters: check-yamlschema file1.yaml file2.yaml ...

Pre-commit usage

Add this to your .pre-commit-config.yaml:

  - repo: https://github.com/jmlrt/check-yamlschema
    rev: v0.0.1
    hooks:
      - id: check-yamlschema

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

check-yamlschema-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

check_yamlschema-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file check-yamlschema-0.0.2.tar.gz.

File metadata

  • Download URL: check-yamlschema-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for check-yamlschema-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6d76afaac3eed8d0afdcc736d61b43aa3d50aaf9e3aa642944d37ae68156d449
MD5 a2d1c62e3f5f05abdb6e8324bdcdcb74
BLAKE2b-256 582d59b864e454f6a2eed8cf4c38a9774a1ad29d7d0abee433a599053796269d

See more details on using hashes here.

File details

Details for the file check_yamlschema-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for check_yamlschema-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77633eea86d908ecf2cc6fabbbbd2ec07216c789e1b292023b43a1001a816fe8
MD5 5dde1953e73d51bd654813bd1b220a67
BLAKE2b-256 e2ff9711a6581facdf293781ab07294a4a25fe52a2d700b04bb27bbec9babbaf

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