fix(apis): intermediate improvements ...

... it shows that the override I used previously won't work for `admin`.
Therefore we have to keep the actual value, instead of degenrating it.

Makes sense ... it's interesting how much one tends to hard-code things
to work just for a few cases, unless you opt in to see the whole picture
This commit is contained in:
Sebastian Thiel
2015-03-10 15:54:31 +01:00
parent ff5cbb3bf4
commit 92d8fa76d0
11 changed files with 32 additions and 14 deletions

View File

@@ -11,7 +11,8 @@
<%
# fr == fattest resource, the fatter, the more important, right ?
fr = None
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
if schemas:
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
%>\
# Features
@@ -62,6 +63,7 @@ Generally speaking, you can invoke *Activities* like this:
let r = hub.resource().activity(...).${api.terms.action}()
```
% if fr:
Or specifically ...
```ignore
@@ -70,6 +72,7 @@ Or specifically ...
let r = hub.${mangle_ident(resource)}().${mangle_ident(activity)}(...).${api.terms.action}()
% endfor
```
% endif
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be

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(name, resource, method)]
m = c.fqan_map[to_fqan(activity_root or name, 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(name, resource, a)]
m = c.fqan_map[to_fqan(activity_root or name, resource, a)]
RType = mb_type(resource, a)
# skip part if we have a request resource. Only resources can have parts

View File

@@ -531,6 +531,8 @@ Context = collections.namedtuple('Context', ['sta_map', 'fqan_map', 'rta_map'])
# return a newly build context from the given data
def new_context(resources):
if not resources:
return Context(dict(), dict(), dict())
# Returns (A, B) where
# A: { SchemaTypeName -> { fqan -> ['request'|'response', ...]}
# B: { fqan -> activity_method_data }