Closed
Description
Hi,
I m trying to parse a swagger.yaml with js-yaml. I have defined anchor variables and referenced them as below.
x-a127-config:
abc: &ABC
xyz: &xyz
x-a127-services:
abc: *abc
**cache-session: *xyz**
The parser throws exception at line *cache-session: xyz
error: unidentified alias "xyz" at line 28, column 22:
cache-session: *xyz
^
Below is my code
var yaml = require('js-yaml');
var doc;
try {
doc = yaml.load(stream.readFileSync(inputFilePath, 'utf8')); //inputFilePath -- is path to my swagger.yaml file
} catch (e) {
console.log(e);
}
Is there any option that can be used while parsing, so that js-yaml will parse the references to anchor variables successfully?