Skip to main content

A YAML parser that resolves JSON references

Project description

yamole Build Status

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

Installation

yamole is available as a PyPI module, so you can install it using pip:

$ pip install yamole

Usage

Using yamole is pretty straightforward. The parser is available through the YamoleParser class:

parser = YamoleParser('input_file.yaml')

output_str = parser.dumps()

parser.data['some-key']  # The dict with the parsed file's structure

Testing

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 (tests/expected.yaml).


(c) 2018 Yago González. All rights reserved

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

yamole-2.0.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

yamole-2.0.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

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