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.2
    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.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for check-yamlschema-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8576b1b1afa040867d2eee9d30559a05976c7cf52995165aeb20e8951df13c87
MD5 a1effb0ed176e52c4fc4304f55da1aa6
BLAKE2b-256 44b80a63558cfb1e5da15d60f5d0071b0445352572e1f7a8e8ee0709cff66c91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for check_yamlschema-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 280a1a820e57637e2645112dc8dd4ec6e69727a9cd540f7b802212b646a48d34
MD5 04c73bb5c8649a92de41f262aaf669c6
BLAKE2b-256 511ef5940041aa0cfd7d1b79ba459235e69ba07c6a8add9c198ec145035f45d3

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