API Reference

Library for validating yaml files against schema and selectively dumping nodes from yaml (or json) documents in yaml or json format.

Functions:

dump(datafile[, path, format, yaml_options, …])

Load the contents of the given YAML file and output in the desired format.

validate(schemafile, datafiles[, encoding])

Validate the given datafiles using a schema.

dump(datafile, path='$', format='yaml', yaml_options='{explicit_start: True, explicit_end: True, allow_unicode: True}', json_options='{indent: 2, encoding: utf-8}', encoding='utf-8')[source]

Load the contents of the given YAML file and output in the desired format.

Parameters
  • datafile (Union[str, Path])

  • path (str) – Default '$'.

  • format (str) – Default 'yaml'.

  • yaml_options (str) – Default '{explicit_start: True, explicit_end: True, allow_unicode: True}'.

  • json_options (str) – Default '{indent: 2, encoding: utf-8}'.

  • encoding (str) – Encoding to open the files with. Default 'utf-8'.

validate(schemafile, datafiles, encoding='utf-8')[source]

Validate the given datafiles using a schema.

Parameters
  • schemafile (Union[str, Path]) – The json or yaml formatted schema to validate with

  • datafiles (Iterable[Union[str, Path]]) – An iterable of json or yaml files to validate

  • encoding (str) – Encoding to open the files with. Default 'utf-8'.