From 385b6c4759515b8b79151984e28932968ba9dc0c Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 24 Sep 2015 13:37:32 +0100 Subject: [PATCH] Only validate a file if it ends with ".yaml". Otherwise we try to validate vim .swp files. --- api/validator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/validator.js b/api/validator.js index 6eef652f3..3b89a5a36 100644 --- a/api/validator.js +++ b/api/validator.js @@ -44,7 +44,8 @@ if (isDir) { process.exit(1); } files.forEach(function(f) { - if (f.indexOf(".yaml") > 0) { + var suffix = ".yaml"; + if (f.indexOf(suffix, f.length - suffix.length) > 0) { parser.parse(path.join(opts.schema, f), function(err, api, metadata) { if (!err) { console.log("%s is valid.", f);