File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
openapi_core/templating/paths Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,9 @@ def find(self, request):
39
39
raise ServerNotFound (request .full_url_pattern )
40
40
41
41
def _get_paths_iter (self , full_url_pattern ):
42
+ template_paths = []
42
43
for path_pattern , path in iteritems (self .spec .paths ):
43
- # simple path
44
+ # simple path. Return right away since it is always the most concrete
44
45
if full_url_pattern .endswith (path_pattern ):
45
46
path_result = TemplateResult (path_pattern , {})
46
47
yield (path , path_result )
@@ -49,7 +50,11 @@ def _get_paths_iter(self, full_url_pattern):
49
50
result = search (path_pattern , full_url_pattern )
50
51
if result :
51
52
path_result = TemplateResult (path_pattern , result .named )
52
- yield (path , path_result )
53
+ template_paths .append ((path , path_result ))
54
+
55
+ # Fewer variables -> more concrete path
56
+ for path in sorted (template_paths , key = lambda p : len (p [1 ].variables )):
57
+ yield path
53
58
54
59
def _get_operations_iter (self , request_method , paths_iter ):
55
60
for path , path_result in paths_iter :
You can’t perform that action at this time.
0 commit comments