json-refs
json-refs copied to clipboard
JsonRefsOptions location set to relative path containing more than 1 level generates invalid fqURI
Notice on https://github.com/whitlockjc/json-refs/blob/master/index.js#L101
function combineURIs (u1, u2) {
...
return (remoteUriTypes.indexOf(combinedDetails.reference) === -1 &&
-> combinedDetails.path.indexOf('../') === 0 ? '../' : '') + URI.serialize(combinedDetails);
combinedDetails.path.indexOf('../') === 0 ? '../' : ''
has the effect of changing location values starting with ../../../foobar
to ../foobar
.
My current work around in node is to prepend the result of process.cwd() + '/' to the location.
const jsonRefsOptions = location => {
return {
filter: ['relative', 'remote'],
loaderOptions: {
processContent: (res, callback) => {
callback(null, YAML.load(res.text));
}
},
location: `${process.cwd()}/${location}`,
includeInvalid: true
};
};