diff --git a/lib/router.js b/lib/router.js index 6fcd94ff..1a23891c 100644 --- a/lib/router.js +++ b/lib/router.js @@ -422,9 +422,8 @@ Router.prototype._handlePaths = function(rootNode, spec, scope) { // Handle paths // Sequence the build process with `.each` to avoid race conditions - // while building the tree. Also sort(), so that fixed path segments sort - // before patterns (by virtue of `[a-zA-Z/] < '{'`). - return P.each(Object.keys(paths).sort(), function(pathPattern) { + // while building the tree. + return P.each(Object.keys(paths), function(pathPattern) { var pathSpec = paths[pathPattern]; var pathURI = new URI(pathPattern, {}, true); var path = pathURI.path; @@ -473,6 +472,9 @@ Router.prototype._handlePaths = function(rootNode, spec, scope) { } else if (segment.modifier === '/') { // Since this path segment is optional, the parent node // has the same value. + // FIXME: Properly handle the case where paths overlap, as + // in /foo and /foo{/bar}, possibly by merging methods + // after initializing them with _handleSwaggerPathSpec(). branchNode.value = value; }