fix(util): resource-to-category map

It allows to obtain category, which we previously dropped
This commit is contained in:
Sebastian Thiel
2015-03-10 16:23:22 +01:00
parent 7816cc8145
commit c7e169dff3
6 changed files with 8 additions and 13 deletions

View File

@@ -1,3 +0,0 @@
{
"name": "groupsSettings"
}

View File

@@ -25,7 +25,6 @@ api:
- discovery # no oauth2
- identitytoolkit # no oauth2
- audit # no oauth2
- admin # ERROR
- webfonts # no oauth2
- customsearch # no oauth2
base_path: "etc/api"

View File

@@ -1,3 +0,0 @@
{
"activity_root": "sql"
}

View File

@@ -32,7 +32,7 @@
<%def name="new(resource, method, c)">\
<%
hub_type_name = hub_type(util.canonical_name())
m = c.fqan_map[to_fqan(activity_root or name, resource, method)]
m = c.fqan_map[to_fqan(c.rtc_map[resource], resource, method)]
# an identifier for a property. We prefix them to prevent clashes with the setters
mb_tparams = mb_type_params_s(m)
ThisType = mb_type(resource, method) + mb_tparams

View File

@@ -51,7 +51,7 @@ impl${rb_params} ResourceMethodsBuilder for ${ThisType} {}
impl${rb_params} ${ThisType} {
% for a in c.rta_map[resource]:
<%
m = c.fqan_map[to_fqan(activity_root or name, resource, a)]
m = c.fqan_map[to_fqan(c.rtc_map[resource], resource, a)]
RType = mb_type(resource, a)
# skip part if we have a request resource. Only resources can have parts

View File

@@ -527,12 +527,12 @@ It should be used to handle progress information, and to implement a certain lev
## -- End Activity Utilities -- @}
Context = collections.namedtuple('Context', ['sta_map', 'fqan_map', 'rta_map'])
Context = collections.namedtuple('Context', ['sta_map', 'fqan_map', 'rta_map', 'rtc_map'])
# return a newly build context from the given data
def new_context(resources):
if not resources:
return Context(dict(), dict(), dict())
return Context(dict(), dict(), dict(), dict())
# Returns (A, B) where
# A: { SchemaTypeName -> { fqan -> ['request'|'response', ...]}
# B: { fqan -> activity_method_data }
@@ -564,7 +564,7 @@ def new_context(resources):
# delete: has no response or request
# getrating: response is a 'SomethingResult', which is still related to activities name
# the latter is used to deduce the resource name
category, an, _ = activity_split(m.id)
_, an, _ = activity_split(m.id)
tn = activity_name_to_type_name(an)
info = res.setdefault(tn, dict())
if m.id not in info:
@@ -577,10 +577,12 @@ def new_context(resources):
sta_map, fqan_map = build_activity_mappings(resources)
rta_map = dict()
rtc_map = dict()
for an in fqan_map:
category, resource, activity = activity_split(an)
rta_map.setdefault(resource, list()).append(activity)
return Context(sta_map, fqan_map, rta_map)
assert rtc_map.setdefault(resource, category) == category
return Context(sta_map, fqan_map, rta_map, rtc_map)
# Expects v to be 'v\d+', throws otherwise
def to_api_version(v):