{"action":"created","comment":{"url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/comments/69294338","id":69294338,"diff_hunk":"@@ -293,14 +296,231 @@ export default class Parser {\n     }\n   }\n \n+  // Conver api key name into Refract elements\n+  apiKeyName(element, apiKey) {\n+    const {Member: MemberElement} = this.minim.elements;\n+    let config;\n+\n+    if (apiKey.in === 'query') {\n+      config = 'queryParameterName';\n+    } else if (apiKey.in === 'header') {\n+      config = 'httpHeaderName';\n+    }\n+\n+    const member = new MemberElement(config, apiKey.name);\n+\n+    if (this.generateSourceMap) {\n+      this.createSourceMap(member, this.path.concat(['name']));\n+    }\n+\n+    element.content.push(member);\n+  }\n+\n+  // Convert Oauth2 flow into Refract elements\n+  oauthGrantType(element, flow) {\n+    const {Member: MemberElement} = this.minim.elements;\n+    let grantType = flow;\n+\n+    if (flow === 'password') {\n+      grantType = 'resource owner password credentials';\n+    } else if (flow === 'application') {\n+      grantType = 'client credentials';\n+    } else if (flow === 'accessCode') {\n+      grantType = 'authorization code';\n+    }\n+\n+    const member = new MemberElement('grantType', grantType);\n+\n+    if (this.generateSourceMap) {\n+      this.createSourceMap(member, this.path.concat(['flow']));\n+    }\n+\n+    element.content.push(member);\n+  }\n+\n+  // Convert OAuth2 scopes into Refract elements\n+  oauthScopes(element, items) {\n+    const {Member: MemberElement, Array: ArrayElement, String: StringElement} = this.minim.elements;\n+    const scopes = new ArrayElement();\n+    let descriptions = null;\n+    let scopesList = items;\n+\n+    if (_.isObject(items) && !_.isArray(items)) {\n+      descriptions = Object.values(items);\n+      scopesList = Object.keys(items);\n+    }\n+\n+    // If value is not an empty array, then they are scopes\n+    _.each(scopesList, (scopeName, index) => {\n+      const scope = new StringElement(scopeName);\n+\n+      if (descriptions) {\n+        scope.description = descriptions[index];\n+\n+        if (this.generateSourceMap) {\n+          this.createSourceMap(scope.meta.get('description'), this.path.concat([scopeName]));\n+        }\n+      }\n+\n+      if (this.generateSourceMap) {\n+        const value = descriptions ? scopeName : index;\n+        this.createSourceMap(scope, this.path.concat([value]));\n+      }\n+\n+      scopes.content.push(scope);\n+    });\n+\n+    if (scopes.length) {\n+      element.content.push(new MemberElement('scopes', scopes));\n+    }\n+  }\n+\n+  // Conver OAuth2 transition information into Refract elements\n+  oauthTransitions(element, oauth) {\n+    const {Transition} = this.minim.elements;\n+\n+    if (oauth.authorizationUrl) {\n+      const transition = new Transition();\n+\n+      transition.relation = 'authorize';\n+      transition.href = oauth.authorizationUrl;\n+\n+      if (this.generateSourceMap) {\n+        this.createSourceMap(transition.attributes.get('href'), this.path.concat(['authorizationUrl']));\n+        this.createSourceMap(transition.attributes.get('relation'), this.path.concat(['authorizationUrl']));\n+      }\n+\n+      element.content.push(transition);\n+    }\n+\n+    if (oauth.tokenUrl) {\n+      const transition = new Transition();\n+\n+      transition.relation = 'token';\n+      transition.href = oauth.tokenUrl;\n+\n+      if (this.generateSourceMap) {\n+        this.createSourceMap(transition.attributes.get('href'), this.path.concat(['tokenUrl']));\n+        this.createSourceMap(transition.attributes.get('relation'), this.path.concat(['tokenUrl']));\n+      }\n+\n+      element.content.push(transition);\n+    }\n+  }\n+\n   // Convert a Swagger auth object into Refract elements.\n   handleSwaggerAuth() {\n-    for (const attribute of ['securityDefinitions', 'security']) {\n-      if (this.swagger[attribute]) {\n-        this.createAnnotation(annotations.DATA_LOST, [attribute],\n-          'Authentication information is not yet supported');\n-      }\n+    const {Category, AuthScheme} = this.minim.elements;\n+    const schemes = [];\n+\n+    if (this.swagger.securityDefinitions) {\n+      _.each(_.keys(this.swagger.securityDefinitions), (name) => {\n+        this.withPath('securityDefinitions', name, () => {\n+          const item = this.swagger.securityDefinitions[name];\n+          const element = new AuthScheme();\n+\n+          switch (item.type) {\n+          case 'basic':\n+            element.element = 'Basic Authentication Scheme';\n+            break;\n+\n+          case 'apiKey':\n+            element.element = 'Token Authentication Scheme';\n+            this.apiKeyName(element, item);\n+            break;\n+\n+          case 'oauth2':\n+            element.element = 'OAuth2 Scheme';\n+            this.oauthGrantType(element, item.flow);\n+\n+            if (item.scopes) {\n+              this.withPath('scopes', () => {\n+                this.oauthScopes(element, item.scopes);\n+              });\n+            }\n+\n+            this.oauthTransitions(element, item);\n+            break;\n+\n+          default:\n+            break;","path":"src/parser.js","position":166,"original_position":166,"commit_id":"36a328d13471fcf49be5d5d49f83bd2e6af57c2b","original_commit_id":"36a328d13471fcf49be5d5d49f83bd2e6af57c2b","user":{"login":"kylef","id":44164,"avatar_url":"https://avatars.githubusercontent.com/u/44164?v=3","gravatar_id":"","url":"https://api.github.com/users/kylef","html_url":"https://github.com/kylef","followers_url":"https://api.github.com/users/kylef/followers","following_url":"https://api.github.com/users/kylef/following{/other_user}","gists_url":"https://api.github.com/users/kylef/gists{/gist_id}","starred_url":"https://api.github.com/users/kylef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylef/subscriptions","organizations_url":"https://api.github.com/users/kylef/orgs","repos_url":"https://api.github.com/users/kylef/repos","events_url":"https://api.github.com/users/kylef/events{/privacy}","received_events_url":"https://api.github.com/users/kylef/received_events","type":"User","site_admin":false},"body":"I think we should if we're given security definitions we don't understand. Informing the user that this scheme is not supported?","created_at":"2016-07-01T12:48:36Z","updated_at":"2016-07-01T12:48:36Z","html_url":"https://github.com/apiaryio/fury-adapter-swagger/pull/73#discussion_r69294338","pull_request_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/comments/69294338"},"html":{"href":"https://github.com/apiaryio/fury-adapter-swagger/pull/73#discussion_r69294338"},"pull_request":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73","id":75973594,"html_url":"https://github.com/apiaryio/fury-adapter-swagger/pull/73","diff_url":"https://github.com/apiaryio/fury-adapter-swagger/pull/73.diff","patch_url":"https://github.com/apiaryio/fury-adapter-swagger/pull/73.patch","issue_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/73","number":73,"state":"open","locked":false,"title":"Authentication and 0.8.0","user":{"login":"pksunkara","id":174703,"avatar_url":"https://avatars.githubusercontent.com/u/174703?v=3","gravatar_id":"","url":"https://api.github.com/users/pksunkara","html_url":"https://github.com/pksunkara","followers_url":"https://api.github.com/users/pksunkara/followers","following_url":"https://api.github.com/users/pksunkara/following{/other_user}","gists_url":"https://api.github.com/users/pksunkara/gists{/gist_id}","starred_url":"https://api.github.com/users/pksunkara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pksunkara/subscriptions","organizations_url":"https://api.github.com/users/pksunkara/orgs","repos_url":"https://api.github.com/users/pksunkara/repos","events_url":"https://api.github.com/users/pksunkara/events{/privacy}","received_events_url":"https://api.github.com/users/pksunkara/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-01T12:37:37Z","updated_at":"2016-07-01T12:48:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8146e77169cc5120fc84cd717106cea9687869e9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73/commits","review_comments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73/comments","review_comment_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/73/comments","statuses_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/statuses/36a328d13471fcf49be5d5d49f83bd2e6af57c2b","head":{"label":"apiaryio:shared/beta","ref":"shared/beta","sha":"36a328d13471fcf49be5d5d49f83bd2e6af57c2b","user":{"login":"apiaryio","id":765943,"avatar_url":"https://avatars.githubusercontent.com/u/765943?v=3","gravatar_id":"","url":"https://api.github.com/users/apiaryio","html_url":"https://github.com/apiaryio","followers_url":"https://api.github.com/users/apiaryio/followers","following_url":"https://api.github.com/users/apiaryio/following{/other_user}","gists_url":"https://api.github.com/users/apiaryio/gists{/gist_id}","starred_url":"https://api.github.com/users/apiaryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apiaryio/subscriptions","organizations_url":"https://api.github.com/users/apiaryio/orgs","repos_url":"https://api.github.com/users/apiaryio/repos","events_url":"https://api.github.com/users/apiaryio/events{/privacy}","received_events_url":"https://api.github.com/users/apiaryio/received_events","type":"Organization","site_admin":false},"repo":{"id":42935158,"name":"fury-adapter-swagger","full_name":"apiaryio/fury-adapter-swagger","owner":{"login":"apiaryio","id":765943,"avatar_url":"https://avatars.githubusercontent.com/u/765943?v=3","gravatar_id":"","url":"https://api.github.com/users/apiaryio","html_url":"https://github.com/apiaryio","followers_url":"https://api.github.com/users/apiaryio/followers","following_url":"https://api.github.com/users/apiaryio/following{/other_user}","gists_url":"https://api.github.com/users/apiaryio/gists{/gist_id}","starred_url":"https://api.github.com/users/apiaryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apiaryio/subscriptions","organizations_url":"https://api.github.com/users/apiaryio/orgs","repos_url":"https://api.github.com/users/apiaryio/repos","events_url":"https://api.github.com/users/apiaryio/events{/privacy}","received_events_url":"https://api.github.com/users/apiaryio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apiaryio/fury-adapter-swagger","description":"Swagger 2.0 parser adapter for Fury.js","fork":false,"url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger","forks_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/forks","keys_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/teams","hooks_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/hooks","issue_events_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/events{/number}","events_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/events","assignees_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/assignees{/user}","branches_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/branches{/branch}","tags_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/tags","blobs_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/statuses/{sha}","languages_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/languages","stargazers_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/stargazers","contributors_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/contributors","subscribers_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/subscribers","subscription_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/subscription","commits_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/contents/{+path}","compare_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/merges","archive_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/downloads","issues_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues{/number}","pulls_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls{/number}","milestones_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/milestones{/number}","notifications_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/labels{/name}","releases_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/releases{/id}","deployments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/deployments","created_at":"2015-09-22T13:24:29Z","updated_at":"2016-01-28T03:20:49Z","pushed_at":"2016-07-01T12:39:10Z","git_url":"git://github.com/apiaryio/fury-adapter-swagger.git","ssh_url":"git@github.com:apiaryio/fury-adapter-swagger.git","clone_url":"https://github.com/apiaryio/fury-adapter-swagger.git","svn_url":"https://github.com/apiaryio/fury-adapter-swagger","homepage":null,"size":238,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":3,"default_branch":"master"}},"base":{"label":"apiaryio:master","ref":"master","sha":"7665bc17f6a0818a2a1279f47c08aab0adcb355f","user":{"login":"apiaryio","id":765943,"avatar_url":"https://avatars.githubusercontent.com/u/765943?v=3","gravatar_id":"","url":"https://api.github.com/users/apiaryio","html_url":"https://github.com/apiaryio","followers_url":"https://api.github.com/users/apiaryio/followers","following_url":"https://api.github.com/users/apiaryio/following{/other_user}","gists_url":"https://api.github.com/users/apiaryio/gists{/gist_id}","starred_url":"https://api.github.com/users/apiaryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apiaryio/subscriptions","organizations_url":"https://api.github.com/users/apiaryio/orgs","repos_url":"https://api.github.com/users/apiaryio/repos","events_url":"https://api.github.com/users/apiaryio/events{/privacy}","received_events_url":"https://api.github.com/users/apiaryio/received_events","type":"Organization","site_admin":false},"repo":{"id":42935158,"name":"fury-adapter-swagger","full_name":"apiaryio/fury-adapter-swagger","owner":{"login":"apiaryio","id":765943,"avatar_url":"https://avatars.githubusercontent.com/u/765943?v=3","gravatar_id":"","url":"https://api.github.com/users/apiaryio","html_url":"https://github.com/apiaryio","followers_url":"https://api.github.com/users/apiaryio/followers","following_url":"https://api.github.com/users/apiaryio/following{/other_user}","gists_url":"https://api.github.com/users/apiaryio/gists{/gist_id}","starred_url":"https://api.github.com/users/apiaryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apiaryio/subscriptions","organizations_url":"https://api.github.com/users/apiaryio/orgs","repos_url":"https://api.github.com/users/apiaryio/repos","events_url":"https://api.github.com/users/apiaryio/events{/privacy}","received_events_url":"https://api.github.com/users/apiaryio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apiaryio/fury-adapter-swagger","description":"Swagger 2.0 parser adapter for Fury.js","fork":false,"url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger","forks_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/forks","keys_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/teams","hooks_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/hooks","issue_events_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/events{/number}","events_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/events","assignees_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/assignees{/user}","branches_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/branches{/branch}","tags_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/tags","blobs_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/statuses/{sha}","languages_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/languages","stargazers_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/stargazers","contributors_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/contributors","subscribers_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/subscribers","subscription_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/subscription","commits_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/contents/{+path}","compare_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/merges","archive_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/downloads","issues_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues{/number}","pulls_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls{/number}","milestones_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/milestones{/number}","notifications_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/labels{/name}","releases_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/releases{/id}","deployments_url":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/deployments","created_at":"2015-09-22T13:24:29Z","updated_at":"2016-01-28T03:20:49Z","pushed_at":"2016-07-01T12:39:10Z","git_url":"git://github.com/apiaryio/fury-adapter-swagger.git","ssh_url":"git@github.com:apiaryio/fury-adapter-swagger.git","clone_url":"https://github.com/apiaryio/fury-adapter-swagger.git","svn_url":"https://github.com/apiaryio/fury-adapter-swagger","homepage":null,"size":238,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73"},"html":{"href":"https://github.com/apiaryio/fury-adapter-swagger/pull/73"},"issue":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/73"},"comments":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/apiaryio/fury-adapter-swagger/statuses/36a328d13471fcf49be5d5d49f83bd2e6af57c2b"}}}}
{"actor":{"display_login":"kylef"}}