{"action":"created","issue":{"url":"https://api.github.com/repos/girder/girder/issues/2607","repository_url":"https://api.github.com/repos/girder/girder","labels_url":"https://api.github.com/repos/girder/girder/issues/2607/labels{/name}","comments_url":"https://api.github.com/repos/girder/girder/issues/2607/comments","events_url":"https://api.github.com/repos/girder/girder/issues/2607/events","html_url":"https://github.com/girder/girder/pull/2607","id":294931657,"number":2607,"title":"Allow plugins to customize parts of REST API Documentation page","user":{"login":"msmolens","id":7122091,"avatar_url":"https://avatars1.githubusercontent.com/u/7122091?v=4","gravatar_id":"","url":"https://api.github.com/users/msmolens","html_url":"https://github.com/msmolens","followers_url":"https://api.github.com/users/msmolens/followers","following_url":"https://api.github.com/users/msmolens/following{/other_user}","gists_url":"https://api.github.com/users/msmolens/gists{/gist_id}","starred_url":"https://api.github.com/users/msmolens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msmolens/subscriptions","organizations_url":"https://api.github.com/users/msmolens/orgs","repos_url":"https://api.github.com/users/msmolens/repos","events_url":"https://api.github.com/users/msmolens/events{/privacy}","received_events_url":"https://api.github.com/users/msmolens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-06T22:12:15Z","updated_at":"2018-02-07T16:25:28Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/girder/girder/pulls/2607","html_url":"https://github.com/girder/girder/pull/2607","diff_url":"https://github.com/girder/girder/pull/2607.diff","patch_url":"https://github.com/girder/girder/pull/2607.patch"},"body":"Allow plugins to customize parts of the REST API Documentation (aka Swagger) page using Mako template inheritance [1]. The Mako template defines two named blocks—\"docsHeader\" and \"docsBody\"—that may be overridden in an inheriting template.\r\n\r\nFor example, a plugin can add its own template directory and specify a template filename in its `load` function:\r\n\r\n    templateDir = os.path.join(getPluginDir(), 'cats', 'server')\r\n    info['apiRoot'].addTemplateDirectory(templateDir)\r\n    info['apiRoot'].templateFilename = 'cats_api_docs.mako'\r\n\r\nThe plugin template can inherit from the default template and override the blocks:\r\n\r\n    <%inherit file=\"api_docs.mako\"/>\r\n\r\n    <%block name=\"docsBody\">\r\n    <p>Warning: This API is not a sandbox; don't get scratched.</p>\r\n    </%block>\r\n\r\nTo avoid hardcoding the default template filename, pass it as a variable:\r\n\r\n    baseTemplateFilename = info['apiRoot'].templateFilename\r\n    info['apiRoot'].updateHtmlVars({\r\n        'baseTemplateFilename': baseTemplateFilename\r\n    })\r\n\r\nand get the value in the template like:\r\n\r\n    <%inherit file=\"${context.get('baseTemplateFilename')}\"/>\r\n\r\n[1] http://docs.makotemplates.org/en/latest/inheritance.html"},"comment":{"url":"https://api.github.com/repos/girder/girder/issues/comments/363824753","html_url":"https://github.com/girder/girder/pull/2607#issuecomment-363824753","issue_url":"https://api.github.com/repos/girder/girder/issues/2607","id":363824753,"user":{"login":"zachmullen","id":555959,"avatar_url":"https://avatars1.githubusercontent.com/u/555959?v=4","gravatar_id":"","url":"https://api.github.com/users/zachmullen","html_url":"https://github.com/zachmullen","followers_url":"https://api.github.com/users/zachmullen/followers","following_url":"https://api.github.com/users/zachmullen/following{/other_user}","gists_url":"https://api.github.com/users/zachmullen/gists{/gist_id}","starred_url":"https://api.github.com/users/zachmullen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachmullen/subscriptions","organizations_url":"https://api.github.com/users/zachmullen/orgs","repos_url":"https://api.github.com/users/zachmullen/repos","events_url":"https://api.github.com/users/zachmullen/events{/privacy}","received_events_url":"https://api.github.com/users/zachmullen/received_events","type":"User","site_admin":false},"created_at":"2018-02-07T16:25:28Z","updated_at":"2018-02-07T16:25:28Z","author_association":"OWNER","body":"Also, we should add a section in the developer docs for this"}}
{"actor":{"display_login":"zachmullen"}}