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.4
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
Built Distribution
File details
Details for the file check_yamlschema-0.0.4.tar.gz
.
File metadata
- Download URL: check_yamlschema-0.0.4.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7c893ee0c3e7735f62b78b04d0058488f27b84e944176fb653286e9bd101320 |
|
MD5 | ba851a2cd54b69956eb318f337d0198c |
|
BLAKE2b-256 | a461a4714e6a3d81b35c4c19da9266b0f52e19a75212abfacd2667f25d64507e |
File details
Details for the file check_yamlschema-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: check_yamlschema-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b562d243908e2302a6a3f52532cdd5db0ba790c27e1ef9d2675fa93fff2e532a |
|
MD5 | 796ff02c2c1b82ea443204616aef0ebc |
|
BLAKE2b-256 | ce1f302aef44cb8b7d24fffb52af5cd354e1925eee60bff26464017dc8823dfc |