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):
3939 raise ServerNotFound (request .full_url_pattern )
4040
4141 def _get_paths_iter (self , full_url_pattern ):
42+ template_paths = []
4243 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
4445 if full_url_pattern .endswith (path_pattern ):
4546 path_result = TemplateResult (path_pattern , {})
4647 yield (path , path_result )
@@ -49,7 +50,11 @@ def _get_paths_iter(self, full_url_pattern):
4950 result = search (path_pattern , full_url_pattern )
5051 if result :
5152 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
5358
5459 def _get_operations_iter (self , request_method , paths_iter ):
5560 for path , path_result in paths_iter :
You can’t perform that action at this time.
0 commit comments