Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92d8fa7

Browse files
committed
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
1 parent ff5cbb3 commit 92d8fa7

11 files changed

Lines changed: 32 additions & 14 deletions

File tree

etc/api/api-list.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ api:
88
adexchangeseller:
99
- v2.0
1010
admin:
11+
- directory_v1
12+
- email_migration_v2
1113
- reports_v1
1214
adsense:
1315
- v1.4
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "groupsSettings"
3+
}

etc/api/shared.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@ directories:
1010
mako_src: src/mako
1111
api:
1212
blacklist:
13-
- groupsmigration
14-
- licensing
15-
- groupssettings
16-
- translate
13+
- groupsmigration # no oauth2
14+
- licensing # no oauth2
15+
- translate # no oauth2
1716
- pagespeedonline # no oauth2
1817
- gan # no oauth2
19-
- sqladmin # ERROR
20-
- dataflow # ERROR
18+
- dataflow # no oauth2
2119
- civicinfo # no oauth2
2220
- webmasters # no oauth2
2321
- doubleclickbidmanager # no oauth2
2422
- freebase # ERROR
2523
- spectrum # no oauth2
26-
- analytics # ERROR
2724
- qpxexpress # no oauth2
2825
- discovery # no oauth2
2926
- identitytoolkit # no oauth2
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"activity_root": "sql"
3+
}

etc/bin/mako-render

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,16 @@ def cmdline(argv=None):
321321
# end for each input file
322322

323323
# From http://stackoverflow.com/questions/7204805/dictionaries-of-dictionaries-merge
324+
# But: We overwrite leafs unconditionally
324325
def merge(a, b, path=None):
325326
if path is None: path = []
326327
for key in b:
327328
if key in a:
328329
if isinstance(a[key], dict) and isinstance(b[key], dict):
329330
merge(a[key], b[key], path + [str(key)])
330-
elif a[key] == b[key]:
331-
pass # same leaf value
332331
else:
333-
raise Exception('Conflict at %s' % '.'.join(path + [str(key)]))
332+
# overwrite leafs unconditionally !
333+
a[key] = b[key]
334334
else:
335335
a[key] = b[key]
336336
return a

src/mako/deps.mako

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
% for version in versions:
1111
<%
1212
import util
13+
import os
1314
gen_root = directories.output + '/' + an + util.to_api_version(version)
1415
gen_root_stamp = gen_root + '/.timestamp'
1516
api_name = util.library_name(an, version)
@@ -20,7 +21,10 @@
2021
sds = [(directories.mako_src + '/' + i.source + '.mako', gen_root + '/' + i.get('output_dir', '') + '/' + i.source)
2122
for i in api.templates]
2223
api_json = directories.api_base + '/' + an + '/' + version + '/' + an + '-api.json'
24+
api_json_overrides = os.path.dirname(api_json) + '/' + an + '-api_overrides.json'
2325
api_json_inputs = api_json + " $(API_SHARED_INFO)"
26+
if os.path.isfile(api_json_overrides):
27+
api_json_inputs += ' ' + api_json_overrides
2428
api_info.append((api_name, api_clean, api_cargo, gen_root))
2529
2630
space_join = lambda i: ' '.join(a[i] for a in api_info)

src/mako/lib.rs.mako

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
rust_module_doc_comment, rb_type, hub_type, mangle_ident, hub_type_params_s,
99
hub_type_bounds, rb_type_params_s)
1010
11-
nested_schemas = list(iter_nested_types(schemas))
11+
nested_schemas = list()
12+
if schemas:
13+
nested_schemas = list(iter_nested_types(schemas))
1214
c = new_context(resources)
1315
hub_type = hub_type(util.canonical_name())
1416
ht_params = hub_type_params_s()
@@ -104,12 +106,14 @@ impl<'a, C, NC, A> ${hub_type}${ht_params}
104106
}
105107

106108

109+
% if schemas:
107110
// ############
108111
// SCHEMAS ###
109112
// ##########
110113
% for s in schemas.values():
111114
${schema.new(s, c)}
112115
% endfor
116+
% endif
113117

114118
% if nested_schemas:
115119
// ###################

src/mako/lib/lib.mako

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<%
1212
# fr == fattest resource, the fatter, the more important, right ?
1313
fr = None
14-
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
14+
if schemas:
15+
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
1516
%>\
1617
# Features
1718

@@ -62,6 +63,7 @@ Generally speaking, you can invoke *Activities* like this:
6263
let r = hub.resource().activity(...).${api.terms.action}()
6364
```
6465

66+
% if fr:
6567
Or specifically ...
6668

6769
```ignore
@@ -70,6 +72,7 @@ Or specifically ...
7072
let r = hub.${mangle_ident(resource)}().${mangle_ident(activity)}(...).${api.terms.action}()
7173
% endfor
7274
```
75+
% endif
7376

7477
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
7578
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be

src/mako/lib/mbuild.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<%def name="new(resource, method, c)">\
3333
<%
3434
hub_type_name = hub_type(util.canonical_name())
35-
m = c.fqan_map[to_fqan(name, resource, method)]
35+
m = c.fqan_map[to_fqan(activity_root or name, resource, method)]
3636
# an identifier for a property. We prefix them to prevent clashes with the setters
3737
mb_tparams = mb_type_params_s(m)
3838
ThisType = mb_type(resource, method) + mb_tparams

src/mako/lib/rbuild.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl${rb_params} ResourceMethodsBuilder for ${ThisType} {}
5151
impl${rb_params} ${ThisType} {
5252
% for a in c.rta_map[resource]:
5353
<%
54-
m = c.fqan_map[to_fqan(name, resource, a)]
54+
m = c.fqan_map[to_fqan(activity_root or name, resource, a)]
5555
RType = mb_type(resource, a)
5656
5757
# skip part if we have a request resource. Only resources can have parts

0 commit comments

Comments
 (0)