{"action":"created","comment":{"url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/comments/91838942","pull_request_review_id":12351335,"id":91838942,"diff_hunk":"@@ -0,0 +1,62 @@\n+# -*- coding: utf-8 -*-\n+#\n+# license: AGPLv3, see LICENSE for details. In addition we strongly encourage\n+#          you to buy us beer if we meet and you like the software.\n+\n+\"\"\"Eve Swagger initialization.\"\"\"\n+\n+from flask import Blueprint, redirect, url_for, request\n+\n+from eve_swagger import swagger, add_documentation\n+\n+from amivapi.utils import register_validator\n+\n+swagger_ui = Blueprint('swagger_ui', __name__,\n+                       static_folder='swagger_ui',\n+                       static_url_path='/docs')\n+\n+\n+@swagger_ui.route('/docs')\n+def index():\n+    \"\"\"Redirect to the correct url to view docs.\"\"\"\n+    return redirect(url_for('swagger_ui.static', filename='index.html') +\n+                    \"?url={}/api-docs\".format(request.url))\n+\n+\n+class DocValidator(object):\n+    \"\"\"Add a schema rule for a 'descriptions field'.\n+\n+    This rule will do nothing, but will stop Cerberus from complaining without\n+    allowing all unknown fields.\n+    \"\"\"\n+\n+    def _validate_description(*args):\n+        \"\"\"Do nothing.\"\"\"\n+\n+\n+def init_app(app):\n+    \"\"\"Create a swagger-ui endpoint at /docs.\"\"\"\n+    # Generate documentation to be used by swagger ui\n+    # will be exposed at /api-docs\n+    app.register_blueprint(swagger, url_prefix=\"/docs\")\n+    # host the swagger ui at /docs\n+\n+    app.register_blueprint(swagger_ui)\n+\n+    register_validator(app, DocValidator)\n+\n+    # replace null-type fields with ''\n+    # TODO: make this dynamic\n+    add_documentation({'definitions': {'User': {'properties': {\n+        'password': {'default': ''},\n+        'nethz': {'default': ''}\n+    }}}})","path":"amivapi/docs.py","position":53,"original_position":53,"commit_id":"be4c594821acba1d2f85c710aad9f4d3f9aeffc1","original_commit_id":"be4c594821acba1d2f85c710aad9f4d3f9aeffc1","user":{"login":"Leonidaz0r","id":2820690,"avatar_url":"https://avatars.githubusercontent.com/u/2820690?v=3","gravatar_id":"","url":"https://api.github.com/users/Leonidaz0r","html_url":"https://github.com/Leonidaz0r","followers_url":"https://api.github.com/users/Leonidaz0r/followers","following_url":"https://api.github.com/users/Leonidaz0r/following{/other_user}","gists_url":"https://api.github.com/users/Leonidaz0r/gists{/gist_id}","starred_url":"https://api.github.com/users/Leonidaz0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leonidaz0r/subscriptions","organizations_url":"https://api.github.com/users/Leonidaz0r/orgs","repos_url":"https://api.github.com/users/Leonidaz0r/repos","events_url":"https://api.github.com/users/Leonidaz0r/events{/privacy}","received_events_url":"https://api.github.com/users/Leonidaz0r/received_events","type":"User","site_admin":false},"body":"What is the purpose of this? We generate empty documentation fields?","created_at":"2016-12-10T17:32:24Z","updated_at":"2016-12-10T17:32:24Z","html_url":"https://github.com/amiv-eth/amivapi/pull/145#discussion_r91838942","pull_request_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145","_links":{"self":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/comments/91838942"},"html":{"href":"https://github.com/amiv-eth/amivapi/pull/145#discussion_r91838942"},"pull_request":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145"}}},"pull_request":{"url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145","id":97429372,"html_url":"https://github.com/amiv-eth/amivapi/pull/145","diff_url":"https://github.com/amiv-eth/amivapi/pull/145.diff","patch_url":"https://github.com/amiv-eth/amivapi/pull/145.patch","issue_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/145","number":145,"state":"open","locked":false,"title":"Swagger rebased updated","user":{"login":"NotSpecial","id":7079143,"avatar_url":"https://avatars.githubusercontent.com/u/7079143?v=3","gravatar_id":"","url":"https://api.github.com/users/NotSpecial","html_url":"https://github.com/NotSpecial","followers_url":"https://api.github.com/users/NotSpecial/followers","following_url":"https://api.github.com/users/NotSpecial/following{/other_user}","gists_url":"https://api.github.com/users/NotSpecial/gists{/gist_id}","starred_url":"https://api.github.com/users/NotSpecial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NotSpecial/subscriptions","organizations_url":"https://api.github.com/users/NotSpecial/orgs","repos_url":"https://api.github.com/users/NotSpecial/repos","events_url":"https://api.github.com/users/NotSpecial/events{/privacy}","received_events_url":"https://api.github.com/users/NotSpecial/received_events","type":"User","site_admin":false},"body":"Fancy new swagger interface for /docs added by hermann","created_at":"2016-12-10T16:04:42Z","updated_at":"2016-12-10T17:48:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fae684975d7e108ccad8c795c12b29e5b6d0f89","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145/commits","review_comments_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145/comments","review_comment_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/145/comments","statuses_url":"https://api.github.com/repos/amiv-eth/amivapi/statuses/be4c594821acba1d2f85c710aad9f4d3f9aeffc1","head":{"label":"amiv-eth:swagger_rebased_updated","ref":"swagger_rebased_updated","sha":"be4c594821acba1d2f85c710aad9f4d3f9aeffc1","user":{"login":"amiv-eth","id":866242,"avatar_url":"https://avatars.githubusercontent.com/u/866242?v=3","gravatar_id":"","url":"https://api.github.com/users/amiv-eth","html_url":"https://github.com/amiv-eth","followers_url":"https://api.github.com/users/amiv-eth/followers","following_url":"https://api.github.com/users/amiv-eth/following{/other_user}","gists_url":"https://api.github.com/users/amiv-eth/gists{/gist_id}","starred_url":"https://api.github.com/users/amiv-eth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amiv-eth/subscriptions","organizations_url":"https://api.github.com/users/amiv-eth/orgs","repos_url":"https://api.github.com/users/amiv-eth/repos","events_url":"https://api.github.com/users/amiv-eth/events{/privacy}","received_events_url":"https://api.github.com/users/amiv-eth/received_events","type":"Organization","site_admin":false},"repo":{"id":25645042,"name":"amivapi","full_name":"amiv-eth/amivapi","owner":{"login":"amiv-eth","id":866242,"avatar_url":"https://avatars.githubusercontent.com/u/866242?v=3","gravatar_id":"","url":"https://api.github.com/users/amiv-eth","html_url":"https://github.com/amiv-eth","followers_url":"https://api.github.com/users/amiv-eth/followers","following_url":"https://api.github.com/users/amiv-eth/following{/other_user}","gists_url":"https://api.github.com/users/amiv-eth/gists{/gist_id}","starred_url":"https://api.github.com/users/amiv-eth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amiv-eth/subscriptions","organizations_url":"https://api.github.com/users/amiv-eth/orgs","repos_url":"https://api.github.com/users/amiv-eth/repos","events_url":"https://api.github.com/users/amiv-eth/events{/privacy}","received_events_url":"https://api.github.com/users/amiv-eth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amiv-eth/amivapi","description":null,"fork":false,"url":"https://api.github.com/repos/amiv-eth/amivapi","forks_url":"https://api.github.com/repos/amiv-eth/amivapi/forks","keys_url":"https://api.github.com/repos/amiv-eth/amivapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amiv-eth/amivapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amiv-eth/amivapi/teams","hooks_url":"https://api.github.com/repos/amiv-eth/amivapi/hooks","issue_events_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/events{/number}","events_url":"https://api.github.com/repos/amiv-eth/amivapi/events","assignees_url":"https://api.github.com/repos/amiv-eth/amivapi/assignees{/user}","branches_url":"https://api.github.com/repos/amiv-eth/amivapi/branches{/branch}","tags_url":"https://api.github.com/repos/amiv-eth/amivapi/tags","blobs_url":"https://api.github.com/repos/amiv-eth/amivapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amiv-eth/amivapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amiv-eth/amivapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/amiv-eth/amivapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amiv-eth/amivapi/statuses/{sha}","languages_url":"https://api.github.com/repos/amiv-eth/amivapi/languages","stargazers_url":"https://api.github.com/repos/amiv-eth/amivapi/stargazers","contributors_url":"https://api.github.com/repos/amiv-eth/amivapi/contributors","subscribers_url":"https://api.github.com/repos/amiv-eth/amivapi/subscribers","subscription_url":"https://api.github.com/repos/amiv-eth/amivapi/subscription","commits_url":"https://api.github.com/repos/amiv-eth/amivapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/amiv-eth/amivapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/amiv-eth/amivapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/amiv-eth/amivapi/contents/{+path}","compare_url":"https://api.github.com/repos/amiv-eth/amivapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amiv-eth/amivapi/merges","archive_url":"https://api.github.com/repos/amiv-eth/amivapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amiv-eth/amivapi/downloads","issues_url":"https://api.github.com/repos/amiv-eth/amivapi/issues{/number}","pulls_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls{/number}","milestones_url":"https://api.github.com/repos/amiv-eth/amivapi/milestones{/number}","notifications_url":"https://api.github.com/repos/amiv-eth/amivapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amiv-eth/amivapi/labels{/name}","releases_url":"https://api.github.com/repos/amiv-eth/amivapi/releases{/id}","deployments_url":"https://api.github.com/repos/amiv-eth/amivapi/deployments","created_at":"2014-10-23T15:51:54Z","updated_at":"2016-12-06T17:00:51Z","pushed_at":"2016-12-10T17:00:38Z","git_url":"git://github.com/amiv-eth/amivapi.git","ssh_url":"git@github.com:amiv-eth/amivapi.git","clone_url":"https://github.com/amiv-eth/amivapi.git","svn_url":"https://github.com/amiv-eth/amivapi","homepage":null,"size":2613,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":27,"forks":0,"open_issues":27,"watchers":17,"default_branch":"master"}},"base":{"label":"amiv-eth:master","ref":"master","sha":"dffbf98e3e0b9a6e925347253dcbedd76e98f3da","user":{"login":"amiv-eth","id":866242,"avatar_url":"https://avatars.githubusercontent.com/u/866242?v=3","gravatar_id":"","url":"https://api.github.com/users/amiv-eth","html_url":"https://github.com/amiv-eth","followers_url":"https://api.github.com/users/amiv-eth/followers","following_url":"https://api.github.com/users/amiv-eth/following{/other_user}","gists_url":"https://api.github.com/users/amiv-eth/gists{/gist_id}","starred_url":"https://api.github.com/users/amiv-eth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amiv-eth/subscriptions","organizations_url":"https://api.github.com/users/amiv-eth/orgs","repos_url":"https://api.github.com/users/amiv-eth/repos","events_url":"https://api.github.com/users/amiv-eth/events{/privacy}","received_events_url":"https://api.github.com/users/amiv-eth/received_events","type":"Organization","site_admin":false},"repo":{"id":25645042,"name":"amivapi","full_name":"amiv-eth/amivapi","owner":{"login":"amiv-eth","id":866242,"avatar_url":"https://avatars.githubusercontent.com/u/866242?v=3","gravatar_id":"","url":"https://api.github.com/users/amiv-eth","html_url":"https://github.com/amiv-eth","followers_url":"https://api.github.com/users/amiv-eth/followers","following_url":"https://api.github.com/users/amiv-eth/following{/other_user}","gists_url":"https://api.github.com/users/amiv-eth/gists{/gist_id}","starred_url":"https://api.github.com/users/amiv-eth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amiv-eth/subscriptions","organizations_url":"https://api.github.com/users/amiv-eth/orgs","repos_url":"https://api.github.com/users/amiv-eth/repos","events_url":"https://api.github.com/users/amiv-eth/events{/privacy}","received_events_url":"https://api.github.com/users/amiv-eth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amiv-eth/amivapi","description":null,"fork":false,"url":"https://api.github.com/repos/amiv-eth/amivapi","forks_url":"https://api.github.com/repos/amiv-eth/amivapi/forks","keys_url":"https://api.github.com/repos/amiv-eth/amivapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amiv-eth/amivapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amiv-eth/amivapi/teams","hooks_url":"https://api.github.com/repos/amiv-eth/amivapi/hooks","issue_events_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/events{/number}","events_url":"https://api.github.com/repos/amiv-eth/amivapi/events","assignees_url":"https://api.github.com/repos/amiv-eth/amivapi/assignees{/user}","branches_url":"https://api.github.com/repos/amiv-eth/amivapi/branches{/branch}","tags_url":"https://api.github.com/repos/amiv-eth/amivapi/tags","blobs_url":"https://api.github.com/repos/amiv-eth/amivapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amiv-eth/amivapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amiv-eth/amivapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/amiv-eth/amivapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amiv-eth/amivapi/statuses/{sha}","languages_url":"https://api.github.com/repos/amiv-eth/amivapi/languages","stargazers_url":"https://api.github.com/repos/amiv-eth/amivapi/stargazers","contributors_url":"https://api.github.com/repos/amiv-eth/amivapi/contributors","subscribers_url":"https://api.github.com/repos/amiv-eth/amivapi/subscribers","subscription_url":"https://api.github.com/repos/amiv-eth/amivapi/subscription","commits_url":"https://api.github.com/repos/amiv-eth/amivapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/amiv-eth/amivapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/amiv-eth/amivapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/amiv-eth/amivapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/amiv-eth/amivapi/contents/{+path}","compare_url":"https://api.github.com/repos/amiv-eth/amivapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amiv-eth/amivapi/merges","archive_url":"https://api.github.com/repos/amiv-eth/amivapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amiv-eth/amivapi/downloads","issues_url":"https://api.github.com/repos/amiv-eth/amivapi/issues{/number}","pulls_url":"https://api.github.com/repos/amiv-eth/amivapi/pulls{/number}","milestones_url":"https://api.github.com/repos/amiv-eth/amivapi/milestones{/number}","notifications_url":"https://api.github.com/repos/amiv-eth/amivapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amiv-eth/amivapi/labels{/name}","releases_url":"https://api.github.com/repos/amiv-eth/amivapi/releases{/id}","deployments_url":"https://api.github.com/repos/amiv-eth/amivapi/deployments","created_at":"2014-10-23T15:51:54Z","updated_at":"2016-12-06T17:00:51Z","pushed_at":"2016-12-10T17:00:38Z","git_url":"git://github.com/amiv-eth/amivapi.git","ssh_url":"git@github.com:amiv-eth/amivapi.git","clone_url":"https://github.com/amiv-eth/amivapi.git","svn_url":"https://github.com/amiv-eth/amivapi","homepage":null,"size":2613,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":27,"forks":0,"open_issues":27,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145"},"html":{"href":"https://github.com/amiv-eth/amivapi/pull/145"},"issue":{"href":"https://api.github.com/repos/amiv-eth/amivapi/issues/145"},"comments":{"href":"https://api.github.com/repos/amiv-eth/amivapi/issues/145/comments"},"review_comments":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145/comments"},"review_comment":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amiv-eth/amivapi/pulls/145/commits"},"statuses":{"href":"https://api.github.com/repos/amiv-eth/amivapi/statuses/be4c594821acba1d2f85c710aad9f4d3f9aeffc1"}}}}
{"actor":{"display_login":"Leonidaz0r"}}