in packages/rulesets/src/spectral/functions/version-policy.ts [11:43]
function checkPaths(targetVal:any) {
const oas2 = targetVal.swagger;
if (oas2) {
const basePath = targetVal.basePath || '';
const version = getVersion(basePath);
if (version) {
return [
{
message: `Version segment "${version}" in basePath violates Azure versioning policy.`,
path: ['basePath'],
},
];
}
}
// We did not find a major version in basePath, so now check the paths
const { paths } = targetVal;
const errors :any[]= [];
if (paths && typeof paths === 'object') {
Object.keys(paths).forEach((path) => {
const version = getVersion(path);
if (version) {
errors.push({
message: `Version segment "${version}" in path violates Azure versioning policy.`,
path: ['paths', path],
});
}
});
}
return errors;
}