Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions stone/backends/obj_c_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ObjCTypesBackend(ObjCBaseBackend):

cmdline_parser = _cmdline_parser
obj_name_to_namespace = {} # type: typing.Dict[str, str]
namespace_to_has_route_auth_list = {} # type: typing.Dict[typing.Any, typing.Set]
namespace_to_has_route_auth_list = {} # type: typing.Dict[typing.Any, typing.List]

def generate(self, api):
"""
Expand Down Expand Up @@ -134,18 +134,25 @@ def generate(self, api):
ns_dict = {"name": ns_name, "children": [], }
jazzy_cfg['custom_categories'].insert(idx, ns_dict)

namespace_to_has_route_auth_list = {}

for namespace in api.namespaces.values():
self.namespace_to_has_route_auth_list[namespace] = set()
namespace_to_has_route_auth_list[namespace] = set()
if namespace.routes:
for route in namespace.routes:
auth_types = set(map(lambda x: x.strip(), route.attrs.get('auth').split(',')))
if 'noauth' not in auth_types:
self.namespace_to_has_route_auth_list[namespace].add(
namespace_to_has_route_auth_list.setdefault(namespace, set()).add(
route.attrs.get('auth'))
else:
self.namespace_to_has_route_auth_list[namespace].add(
namespace_to_has_route_auth_list.setdefault(namespace, set()).add(
'user')

self.namespace_to_has_route_auth_list = {
k: sorted(v)
for k, v in namespace_to_has_route_auth_list.items()
}

with self.output_to_relative_path('DBSDKImportsGenerated.h'):
self._generate_all_imports(api)

Expand Down
Loading