in functions/version-policy.js [67:100]
function checkVersionParam(targetVal) {
const { paths } = targetVal;
const errors = [];
if (paths && typeof paths === 'object') {
Object.keys(paths).forEach((path) => {
// Parameters can be defined at the path level.
if (paths[path].parameters && Array.isArray(paths[path].parameters)) {
const versionParam = findVersionParam(paths[path].parameters);
if (versionParam) {
const index = paths[path].parameters.indexOf(versionParam);
errors.push(...validateVersionParam(versionParam, ['paths', path, 'parameters', index.toString()]));
return;
}
}
['get', 'post', 'put', 'patch', 'delete'].forEach((method) => {
if (paths[path][method]) {
const versionParam = findVersionParam(paths[path][method].parameters);
if (versionParam) {
const index = paths[path][method].parameters.indexOf(versionParam);
errors.push(...validateVersionParam(versionParam, ['paths', path, method, 'parameters', index]));
} else {
errors.push({
message: 'Operation does not define an "api-version" query parameter.',
path: ['paths', path, method, 'parameters'],
});
}
}
});
});
}
return errors;
}