fix: backslashes in $refs to paths on split command from windows (#493)

This commit is contained in:
Roman Marshevskyy
2022-01-04 10:18:34 +02:00
committed by GitHub
parent bd119b612c
commit 713683e0ae
3 changed files with 87 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import { red, blue, yellow, green } from 'colorette';
import * as fs from 'fs';
import { parseYaml } from '@redocly/openapi-core';
import { parseYaml, slash } from '@redocly/openapi-core';
import * as path from 'path';
import { performance } from 'perf_hooks';
const isEqual = require('lodash.isequal');
@@ -266,14 +266,13 @@ function iteratePaths(
fs.writeFileSync(sampleFileName, sample.source);
// @ts-ignore
sample.source = {
$ref: path.relative(pathsDir, sampleFileName)
$ref: slash(path.relative(pathsDir, sampleFileName))
};
}
}
writeYaml(pathData, pathFile);
paths[oasPath] = {
$ref: path.relative(openapiDir, pathFile)
$ref: slash(path.relative(openapiDir, pathFile))
};
}
}
@@ -331,3 +330,7 @@ function iterateComponents(
}
}
}
export {
iteratePaths,
}