Skip to content

Commit

Permalink
Revert path sorting
Browse files Browse the repository at this point in the history
We have some latent issues in the handling of overlapping paths (such as
/foo and /foo{/bar}) that aren't easy to resolve. For now, we are relying on
speccing entry points in just the right order to work around this.
  • Loading branch information
gwicke committed Aug 17, 2016
1 parent e8ef2b9 commit a4508bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a4508bc

Please sign in to comment.