From 1e332ddb91540c19586e6d85869c8e54c47552b0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 10 Mar 2015 15:58:39 +0100 Subject: [PATCH] fix(libdocs): asssure candidate is in mapping It seems nearly nothing can be taken for granted ;). It's best to just run against a big set of APIs and fix issues as they arise though. More flexibility means more maintenance, after all. --- etc/api/shared.yaml | 2 +- src/mako/lib/lib.mako | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 8635b04f76..f9272d5f3c 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -19,7 +19,7 @@ api: - civicinfo # no oauth2 - webmasters # no oauth2 - doubleclickbidmanager # no oauth2 - - freebase # ERROR + - freebase # no oauth2 - spectrum # no oauth2 - qpxexpress # no oauth2 - discovery # no oauth2 diff --git a/src/mako/lib/lib.mako b/src/mako/lib/lib.mako index f7d0342a2f..7a45f3ef65 100644 --- a/src/mako/lib/lib.mako +++ b/src/mako/lib/lib.mako @@ -12,7 +12,11 @@ # fr == fattest resource, the fatter, the more important, right ? fr = None if schemas: - fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0] + for candidate in sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True): + if candidate.id in c.sta_map: + fr = candidate + break + # end for each candidate to check %>\ # Features