Low commit activity in last 3 years
No release in over a year
Resolves referencing to other YAML files.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 0.10
~> 13.0
 Project Readme

YamlRefResolver

Gem Version Test

This is a gem that resolves and expands $ref references to other YAML files.

Installation

Just add this line to your application's Gemfile and run bundle install.

gem 'yaml_ref_resolver'

Usage

Assume that we have following yaml files.

# index.yaml
author:
  $ref: './john.yaml#/profile'
# john.yaml
profile:
  name: John
  age: 28

This gem resolves $ref references.

resolver = YamlRefResolver.new

hash = resolver.resolve!('index.yaml')
#=> {'author' => {'name' => "john", 'age' => 28}}

Optionally you can specify the key.

resolver = YamlRefResolver.new(key: '$import')

CLI

Give an entry point yaml with -i or --input option.

$ yaml_ref_resolver -i ./path/to/index.yaml

# dump to stdout

Optionally output file path with -o or --output can be given.

$ yaml_ref_resolver -i ./path/to/index.yaml -o ./path/to/output.yaml

-w or --watch option watches referenced yaml files and dump whole resolved yaml when one of them changed.

$ yaml_ref_resolver -i ./path/to/index.yaml -w

-j or --json switch outputs in json format instead of yaml format.

$ yaml_ref_resolver -i ./path/to/index.yaml -j

Contributing

Bug reports and pull requests are very welcome on GitHub at https://github.com/Joe-noh/yaml_ref_resolver.

License

The gem is available as open source under the terms of the MIT License.