Skip to content

Commit

Permalink
Update src/plugins/validation/2and3/semantic-validators/operation-ids.js
Browse files Browse the repository at this point in the history
Co-Authored-By: Dustin Popp <dpopp07@gmail.com>
  • Loading branch information
2 people authored and Shuyu Chen committed Jan 29, 2020
1 parent 410a275 commit ce648a3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ module.exports.validate = function({ resolvedSpec }) {
return !!prev;
};

const operationIdPassedConventionCheck = (opKey, operationId, pathParam) => {
const operationIdPassedConventionCheck = (opKey, operationId, hasPathParam) => {
// Only consider paths for which
// - paths with no path param has a GET and POST path
// - paths with path param has a GET, a DELETE, and a POST or PUT or PATCH.

let checkPassed = true;

if (!pathParam) {
if (!hasPathParam) {
// operationId for GET should starts with "list"
if (opKey === 'get' && !operationId.match(/^list[a-zA-Z0-9_]+/m)) {
checkPassed = false;
Expand Down

0 comments on commit ce648a3

Please sign in to comment.