swagger-tools
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -864,3 +864,3 @@ /* | ||
// Process the API definitions | ||
_.reduce(apiDeclaration.apis, function (apisMetadata, api, index) { | ||
_.reduce(apiDeclaration.apis, function (seenPaths, api, index) { | ||
var aPath = ['apis', index.toString()]; | ||
@@ -870,7 +870,7 @@ var nPath = normalizePath(api.path); | ||
// Validate duplicate resource path | ||
if (apisMetadata.paths.indexOf(nPath.path) > -1) { | ||
if (seenPaths.indexOf(nPath.path) > -1) { | ||
createErrorOrWarning('DUPLICATE_API_PATH', 'API path (or equivalent) already defined: ' + api.path, | ||
aPath.concat('path'), aResults.errors); | ||
} else { | ||
apisMetadata.paths.push(nPath.path); | ||
seenPaths.push(nPath.path); | ||
} | ||
@@ -881,12 +881,3 @@ | ||
var oPath = aPath.concat(['operations', index.toString()]); | ||
var nickname = operation.nickname; | ||
// Validate duplicate nickname | ||
if (apisMetadata.nicknames.indexOf(nickname) > -1) { | ||
createErrorOrWarning('DUPLICATE_API_NICKNAME', 'API nickname already defined: ' + nickname, | ||
oPath.concat('nickname'), aResults.errors); | ||
} else { | ||
apisMetadata.nicknames.push(nickname); | ||
} | ||
// Validate duplicate operation method | ||
@@ -932,7 +923,4 @@ validateNoExist(seenMethods, operation.method, 'OPERATION_METHOD', 'Operation method', oPath.concat('method'), | ||
return apisMetadata; | ||
}, { | ||
paths: [], | ||
nicknames: [] | ||
}); | ||
return seenPaths; | ||
}, []); | ||
@@ -972,3 +960,3 @@ // Validate API Declaration definitions | ||
_.reduce(documentMetadata.resolved.paths, function (pathsMetadata, path, name) { | ||
_.reduce(documentMetadata.resolved.paths, function (seenPaths, path, name) { | ||
var pPath = ['paths', name]; | ||
@@ -978,7 +966,5 @@ var nPath = normalizePath(name); | ||
// Validate duplicate resource path | ||
if (pathsMetadata.paths.indexOf(nPath.path) > -1) { | ||
if (seenPaths.indexOf(nPath.path) > -1) { | ||
createErrorOrWarning('DUPLICATE_API_PATH', 'API path (or equivalent) already defined: ' + name, pPath, | ||
results.errors); | ||
} else { | ||
pathsMetadata.paths.push(nPath.path); | ||
} | ||
@@ -993,3 +979,2 @@ | ||
var oPath = pPath.concat(method); | ||
var operationId = operation.operationId; | ||
var seenParams = []; | ||
@@ -1001,12 +986,2 @@ | ||
// Validate duplicate operationId | ||
if (!_.isUndefined(operationId)) { | ||
if (pathsMetadata.operationIds.indexOf(operationId) > -1) { | ||
createErrorOrWarning('DUPLICATE_API_OPERATIONID', 'API operationId already defined: ' + operationId, | ||
oPath.concat('operationId'), results.errors); | ||
} else { | ||
pathsMetadata.operationIds.push(operationId); | ||
} | ||
} | ||
// Process security references | ||
@@ -1052,7 +1027,4 @@ processAuthRefs(documentMetadata, operation.security, oPath.concat('security'), results); | ||
return pathsMetadata; | ||
}, { | ||
operationIds: [], | ||
paths: [] | ||
}); | ||
return seenPaths.concat(nPath.path); | ||
}, []); | ||
@@ -1059,0 +1031,0 @@ // Validate definitions |
{ | ||
"name": "swagger-tools", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Various tools for using and integrating with Swagger.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2735297
33025