Skip to content

Commit

Permalink
improves url grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
napster125 committed Mar 1, 2014
1 parent e45a97c commit 9c7daf8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rest_framework_swagger/urlparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def get_apis(self, patterns=None, filter_path=None, exclude_namespaces=[]):
def get_filtered_apis(self, apis, filter_path):
filtered_list = []

match = "/{f}/".format(f=filter_path)
for api in apis:
if filter_path in api['path'].strip('/'):
if api['path'].startswith(match):
filtered_list.append(api)

return filtered_list
Expand Down Expand Up @@ -70,7 +71,7 @@ def __filter_top_level_apis__(self, root_paths):
filtered_paths = set()
base_path = self.__get_base_path__(root_paths)
for path in root_paths:
resource = path.lstrip(base_path).split('/')[0]
resource = path.replace(base_path, '').split('/')[0]
filtered_paths.add(base_path + resource)

return list(filtered_paths)
Expand Down

0 comments on commit 9c7daf8

Please sign in to comment.