Seems like this is not active anymore, but in case, you start again anytime and want to support imports: The following does the trick:
Psych.add_domain_type 'include', 'include' do |_, value|
case value
when /^https?:\/\//
# TODO implement remote loading of included files
''
else
case value
when /\.raml$/
read_yaml(value)
when /\.ya?ml$/
read_yaml(value)
else
File.read(value)
end
end
end
def read_yaml(path)
# change working directory so that !includes work properly
pwd_old = Dir.pwd
Dir.chdir(File.dirname(path))
raw = File.read(File.basename(path))
node = YAML.load(raw)
Dir.chdir(pwd_old)
node
end
Seems like this is not active anymore, but in case, you start again anytime and want to support imports: The following does the trick: