merged into swagger-js

This commit is contained in:
Tony Tam
2015-01-29 12:47:59 -08:00
9 changed files with 187 additions and 66 deletions

View File

@@ -52,9 +52,10 @@ class OperationView extends Backbone.View
if @model.description
@model.description = @model.description.replace(/(?:\r\n|\r|\n)/g, '<br />')
@model.oauth = null
if @model.authorizations
if Array.isArray @model.authorizations
for auths in @model.authorizations
modelAuths = @model.authorizations || @model.security
if modelAuths
if Array.isArray modelAuths
for auths in modelAuths
for key, auth of auths
for a of @auths
auth = @auths[a]
@@ -62,10 +63,12 @@ class OperationView extends Backbone.View
@model.oauth = {}
@model.oauth.scopes = []
for k, v of auth.value.scopes
o = {scope: k, description: v}
@model.oauth.scopes.push o
scopeIndex = auths[key].indexOf k
if scopeIndex >= 0
o = {scope: k, description: v}
@model.oauth.scopes.push o
else
for k, v of @model.authorizations
for k, v of modelAuths
if k == "oauth2"
if @model.oauth == null
@model.oauth = {}

View File

@@ -10,6 +10,11 @@ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
function(key, value) {
return key===""?value:decodeURIComponent(value) }
):{}
window.opener.onOAuthComplete(qp);
if (window.opener.swaggerUi.tokenUrl)
window.opener.processOAuthCode(qp);
else
window.opener.onOAuthComplete(qp);
window.close();
</script>