updated to latest swagger-js
This commit is contained in:
@@ -35,14 +35,13 @@ class SwaggerUi extends Backbone.Router
|
||||
# Event handler for when url/key is received from user
|
||||
updateSwaggerUi: (data) ->
|
||||
@options.discoveryUrl = data.discoveryUrl
|
||||
@options.apiKey = data.apiKey
|
||||
@load()
|
||||
|
||||
# Create an api and render
|
||||
load: ->
|
||||
# Initialize the API object
|
||||
@mainView?.clear()
|
||||
@headerView.update(@options.discoveryUrl, @options.apiKey)
|
||||
@headerView.update(@options.discoveryUrl)
|
||||
@api = new SwaggerApi(@options)
|
||||
|
||||
# This is bound to success handler for SwaggerApi
|
||||
|
||||
@@ -9,17 +9,16 @@ class HeaderView extends Backbone.View
|
||||
|
||||
initialize: ->
|
||||
|
||||
|
||||
showPetStore: (e) ->
|
||||
@trigger(
|
||||
'update-swagger-ui'
|
||||
{discoveryUrl:"http://petstore.swagger.wordnik.com/api/api-docs.json", apiKey:"special-key"}
|
||||
{discoveryUrl:"http://petstore.swagger.wordnik.com/api/api-docs.json"}
|
||||
)
|
||||
|
||||
showWordnikDev: (e) ->
|
||||
@trigger(
|
||||
'update-swagger-ui'
|
||||
{discoveryUrl:"http://api.wordnik.com/v4/resources.json", apiKey:""}
|
||||
{discoveryUrl:"http://api.wordnik.com/v4/resources.json"}
|
||||
)
|
||||
|
||||
showCustomOnKeyup: (e) ->
|
||||
|
||||
@@ -68,17 +68,18 @@ class OperationView extends Backbone.View
|
||||
|
||||
# if error free submit it
|
||||
if error_free
|
||||
map = {parent: @}
|
||||
map = {}
|
||||
opts = {parent: @}
|
||||
for o in form.serializeArray()
|
||||
if(o.value? && jQuery.trim(o.value).length > 0)
|
||||
map[o.name] = o.value
|
||||
|
||||
console.log map
|
||||
|
||||
map["responseContentType"] = $("div select[name=responseContentType]", $(@el)).val()
|
||||
map["requestContentType"] = $("div select[name=parameterContentType]", $(@el)).val()
|
||||
opts.responseContentType = $("div select[name=responseContentType]", $(@el)).val()
|
||||
opts.requestContentType = $("div select[name=parameterContentType]", $(@el)).val()
|
||||
|
||||
@model.do(map, @showCompleteStatus, @showErrorStatus, @)
|
||||
@model.do(map, opts, @showCompleteStatus, @showErrorStatus, @)
|
||||
|
||||
success: (response, parent) ->
|
||||
parent.showCompleteStatus response
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
console.log("key: " + key);
|
||||
if(key && key.trim() != "") {
|
||||
console.log("added key " + key);
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class='heading'>
|
||||
<h2>
|
||||
<a href='#!/{{name}}' onclick="Docs.toggleEndpointListForResource('{{name}}');">/{{name}}</a>
|
||||
<a href='#!/{{name}}' onclick="Docs.toggleEndpointListForResource('{{name}}');">{{name}}</a>
|
||||
</h2>
|
||||
<ul class='options'>
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user