A YAML parser that resolves JSON references
Dig through the JSON references inside a YAML file, the kind of situation you may run into when parsing OpenAPI files.
The result is a single, big YAML file with all the references resolved (i.e. with their contents replaced in the corresponding places).
yamole also includes small features that help you parse OpenAPI files, like
combining all the elements in an
key into a single object.
yamole is available as a PyPI module, so you can install it using
$ pip install yamole
Using yamole is pretty straightforward. The parser is available through the
with open('input_file.yaml') as file: parser = YamoleParser(file, merge_allof=False, # Combine allOfs into single dicts and disable # inheritance for "example" keys (def: True) max_depth=314) # Allow a maximum of 314 nesting levels (def: 1000) output_str = parser.dumps() parser.data['some-key'] # The dict with the parsed file's structure
To test that yamole works properly, you can run:
$ pip install -r requirements.txt $ python tests/test.py
This will run the parser against a specific test case that makes use of all of
yamole's features, and will compare the result with a fixture
(c) 2018 Yago González. All rights reserved
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size yamole-2.1.6-py3-none-any.whl (4.7 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size yamole-2.1.6.tar.gz (4.5 kB)||File type Source||Python version None||Upload date||Hashes View hashes|