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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

check_yamlschema-0.0.7-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file check_yamlschema-0.0.7.tar.gz.

File metadata

  • Download URL: check_yamlschema-0.0.7.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for check_yamlschema-0.0.7.tar.gz
Algorithm Hash digest
SHA256 eb8937d0e9201d779048414db2912e923216b5291874f77ba4122ccffc467d9c
MD5 807e72f3e83675c4117f553a98376ffe
BLAKE2b-256 cf05013798d70e27b5a8e3f7f2f400b3e9f4ff2801ce0518a338e01c66390884

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for check_yamlschema-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a7a7a5660a2e2dd62033032889cf8a9c613e212c645403b4166a16676a7c5c85
MD5 7def87df2b09705c6bcb1e2740de6ca9
BLAKE2b-256 2e49f3950b9d5a33f89658fc6f4cfc725222f85181bf4908beb0e0690c56e593

See more details on using hashes here.

Supported by

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