API Reference

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

ytools.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]
Parameters
  • datafile (Union[str, Path]) –

  • path (str) –

  • format (str) –

  • yaml_options (str) –

  • json_options (str) –

  • encoding (str) – Encoding to open the files with.

Return type

None

ytools.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.

Return type

None