Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 98c1144c
authored
Jan 11, 2015
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new swagger and url logic
1 parent
e73a21db
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2902 additions
and
678 deletions
code/moya-web/WebContent/swagger/css/screen.css
code/moya-web/WebContent/swagger/index.html
code/moya-web/WebContent/swagger/lib/shred.bundle.js
code/moya-web/WebContent/swagger/lib/swagger-client.js
code/moya-web/WebContent/swagger/lib/swagger-oauth.js
code/moya-web/WebContent/swagger/lib/swagger.js
code/moya-web/WebContent/swagger/swagger-ui.js
code/moya-web/WebContent/swagger/swagger-ui.min.js
code/moya-web/WebContent/swagger/css/screen.css
View file @
98c1144
...
@@ -743,17 +743,20 @@
...
@@ -743,17 +743,20 @@
display
:
inline-block
;
display
:
inline-block
;
font-size
:
0.9em
;
font-size
:
0.9em
;
}
}
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
div
.sandbox_header
img
{
display
:
block
;
clear
:
none
;
float
:
right
;
}
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
div
.sandbox_header
input
.submit
{
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
div
.sandbox_header
input
.submit
{
display
:
block
;
display
:
block
;
clear
:
none
;
clear
:
none
;
float
:
left
;
float
:
left
;
padding
:
6px
8px
;
padding
:
6px
8px
;
}
}
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
div
.sandbox_header
span
.response_throbber
{
background-image
:
url('../images/throbber.gif')
;
width
:
128px
;
height
:
16px
;
display
:
block
;
clear
:
none
;
float
:
right
;
}
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
form
input
[
type
=
'text'
]
.error
{
.swagger-section
.swagger-ui-wrap
ul
#resources
li
.resource
ul
.endpoints
li
.endpoint
ul
.operations
li
.operation
div
.content
form
input
[
type
=
'text'
]
.error
{
outline
:
2px
solid
black
;
outline
:
2px
solid
black
;
outline-color
:
#cc0000
;
outline-color
:
#cc0000
;
...
...
code/moya-web/WebContent/swagger/index.html
View file @
98c1144
...
@@ -16,21 +16,24 @@
...
@@ -16,21 +16,24 @@
<script
src=
'lib/underscore-min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/underscore-min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/backbone-min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/backbone-min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/swagger.js'
type=
'text/javascript'
></script>
<script
src=
'lib/swagger.js'
type=
'text/javascript'
></script>
<script
src=
'lib/swagger-client.js'
type=
'text/javascript'
></script>
<script
src=
'swagger-ui.js'
type=
'text/javascript'
></script>
<script
src=
'swagger-ui.js'
type=
'text/javascript'
></script>
<script
src=
'lib/highlight.7.3.pack.js'
type=
'text/javascript'
></script>
<script
src=
'lib/highlight.7.3.pack.js'
type=
'text/javascript'
></script>
<!-- enabling this will enable oauth2 implicit scope support -->
<!-- enabling this will enable oauth2 implicit scope support -->
<script
src=
'lib/swagger-oauth.js'
type=
'text/javascript'
></script>
<script
src=
'lib/swagger-oauth.js'
type=
'text/javascript'
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
function
()
{
$
(
function
()
{
var
url
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
'/MoyaWeb/rest/api-docs'
;
if
(
!
url
||
url
.
length
<
1
)
{
url
=
"http://localhost:8080/MoyaWeb/rest/api-docs"
;
}
window
.
swaggerUi
=
new
SwaggerUi
({
window
.
swaggerUi
=
new
SwaggerUi
({
url
:
"http://localhost:8080/MoyaWeb/rest/api-docs"
,
url
:
url
,
dom_id
:
"swagger-ui-container"
,
dom_id
:
"swagger-ui-container"
,
supportedSubmitMethods
:
[
'get'
,
'post'
,
'put'
,
'delete'
],
supportedSubmitMethods
:
[
'get'
,
'post'
,
'put'
,
'delete'
],
onComplete
:
function
(
swaggerApi
,
swaggerUi
){
onComplete
:
function
(
swaggerApi
,
swaggerUi
){
log
(
"Loaded SwaggerUI"
);
log
(
"Loaded SwaggerUI"
);
if
(
typeof
initOAuth
==
"function"
)
{
if
(
typeof
initOAuth
==
"function"
)
{
/*
/*
initOAuth({
initOAuth({
...
@@ -47,17 +50,30 @@
...
@@ -47,17 +50,30 @@
onFailure
:
function
(
data
)
{
onFailure
:
function
(
data
)
{
log
(
"Unable to Load SwaggerUI"
);
log
(
"Unable to Load SwaggerUI"
);
},
},
docExpansion
:
"none"
docExpansion
:
"none"
,
sorter
:
"alpha"
});
});
$
(
'#input_apiKey'
).
change
(
func
tion
()
{
function
addApiKeyAuthoriza
tion
()
{
var
key
=
$
(
'#input_apiKey'
)[
0
].
value
;
var
key
=
$
(
'#input_apiKey'
)[
0
].
value
;
log
(
"key: "
+
key
);
log
(
"key: "
+
key
);
if
(
key
&&
key
.
trim
()
!=
""
)
{
if
(
key
&&
key
.
trim
()
!=
""
)
{
log
(
"added key "
+
key
);
log
(
"added key "
+
key
);
window
.
authorizations
.
add
(
"
key"
,
new
ApiKeyAuthorization
(
"api_key"
,
key
,
"query"
));
window
.
authorizations
.
add
(
"api_
key"
,
new
ApiKeyAuthorization
(
"api_key"
,
key
,
"query"
));
}
}
})
}
$
(
'#input_apiKey'
).
change
(
function
()
{
addApiKeyAuthorization
();
});
// if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
/*
var apiKey = "myApiKeyXXXX123456789";
$('#input_apiKey').val(apiKey);
addApiKeyAuthorization();
*/
window
.
swaggerUi
.
load
();
window
.
swaggerUi
.
load
();
});
});
</script>
</script>
...
@@ -66,14 +82,8 @@
...
@@ -66,14 +82,8 @@
<body
class=
"swagger-section"
>
<body
class=
"swagger-section"
>
<div
id=
'header'
>
<div
id=
'header'
>
<div
class=
"swagger-ui-wrap"
>
<div
class=
"swagger-ui-wrap"
>
<a
id=
"logo"
href=
"http://swagger.
wordnik.com
"
>
swagger
</a>
<a
id=
"logo"
href=
"http://swagger.
io
"
>
swagger
</a>
<form
id=
'api_selector'
>
<form
id=
'api_selector'
>
<div
class=
'input icon-btn'
>
<img
id=
"show-pet-store-icon"
src=
"images/pet_store_api.png"
title=
"Show Swagger Petstore Example Apis"
>
</div>
<div
class=
'input icon-btn'
>
<img
id=
"show-wordnik-dev-icon"
src=
"images/wordnik_api.png"
title=
"Show Wordnik Developer Apis"
>
</div>
<div
class=
'input'
><input
placeholder=
"http://example.com/api"
id=
"input_baseUrl"
name=
"baseUrl"
type=
"text"
/></div>
<div
class=
'input'
><input
placeholder=
"http://example.com/api"
id=
"input_baseUrl"
name=
"baseUrl"
type=
"text"
/></div>
<div
class=
'input'
><input
placeholder=
"api_key"
id=
"input_apiKey"
name=
"apiKey"
type=
"text"
/></div>
<div
class=
'input'
><input
placeholder=
"api_key"
id=
"input_apiKey"
name=
"apiKey"
type=
"text"
/></div>
<div
class=
'input'
><a
id=
"explore"
href=
"#"
>
Explore
</a></div>
<div
class=
'input'
><a
id=
"explore"
href=
"#"
>
Explore
</a></div>
...
...
code/moya-web/WebContent/swagger/lib/shred.bundle.js
View file @
98c1144
...
@@ -2131,10 +2131,10 @@ require.define("/shred/mixins/headers.js", function (require, module, exports, _
...
@@ -2131,10 +2131,10 @@ require.define("/shred/mixins/headers.js", function (require, module, exports, _
// to `Content-Type`.
// to `Content-Type`.
var
corsetCase
=
function
(
string
)
{
var
corsetCase
=
function
(
string
)
{
return
string
.
toLowerCase
()
return
string
;
//
.toLowerCase()
//.replace("_","-")
//.replace("_","-")
.
replace
(
/
(
^|-
)(\w)
/g
,
//
.replace(/(^|-)(\w)/g,
function
(
s
)
{
return
s
.
toUpperCase
();
});
//
function(s) { return s.toUpperCase(); });
};
};
// We suspect that `initializeHeaders` was once more complicated ...
// We suspect that `initializeHeaders` was once more complicated ...
...
...
code/moya-web/WebContent/swagger/lib/swagger-client.js
0 → 100644
View file @
98c1144
// swagger-client.js
// version 2.1.0-alpha.5
/**
* Array Model
**/
var
ArrayModel
=
function
(
definition
)
{
this
.
name
=
"name"
;
this
.
definition
=
definition
||
{};
this
.
properties
=
[];
this
.
type
;
this
.
ref
;
var
requiredFields
=
definition
.
enum
||
[];
var
items
=
definition
.
items
;
if
(
items
)
{
var
type
=
items
.
type
;
if
(
items
.
type
)
{
this
.
type
=
typeFromJsonSchema
(
type
.
type
,
type
.
format
);
}
else
{
this
.
ref
=
items
[
'$ref'
];
}
}
}
ArrayModel
.
prototype
.
createJSONSample
=
function
(
modelsToIgnore
)
{
var
result
;
modelsToIgnore
=
(
modelsToIgnore
||
{})
if
(
this
.
type
)
{
result
=
type
;
}
else
if
(
this
.
ref
)
{
var
name
=
simpleRef
(
this
.
ref
);
result
=
models
[
name
].
createJSONSample
();
}
return
[
result
];
};
ArrayModel
.
prototype
.
getSampleValue
=
function
(
modelsToIgnore
)
{
var
result
;
modelsToIgnore
=
(
modelsToIgnore
||
{})
if
(
this
.
type
)
{
result
=
type
;
}
else
if
(
this
.
ref
)
{
var
name
=
simpleRef
(
this
.
ref
);
result
=
models
[
name
].
getSampleValue
(
modelsToIgnore
);
}
return
[
result
];
}
ArrayModel
.
prototype
.
getMockSignature
=
function
(
modelsToIgnore
)
{
var
propertiesStr
=
[];
if
(
this
.
ref
)
{
return
models
[
simpleRef
(
this
.
ref
)].
getMockSignature
();
}
};
/**
* SwaggerAuthorizations applys the correct authorization to an operation being executed
*/
var
SwaggerAuthorizations
=
function
()
{
this
.
authz
=
{};
};
SwaggerAuthorizations
.
prototype
.
add
=
function
(
name
,
auth
)
{
this
.
authz
[
name
]
=
auth
;
return
auth
;
};
SwaggerAuthorizations
.
prototype
.
remove
=
function
(
name
)
{
return
delete
this
.
authz
[
name
];
};
SwaggerAuthorizations
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
var
status
=
null
;
var
key
;
// if the "authorizations" key is undefined, or has an empty array, add all keys
if
(
typeof
authorizations
===
'undefined'
||
Object
.
keys
(
authorizations
).
length
==
0
)
{
for
(
key
in
this
.
authz
)
{
value
=
this
.
authz
[
key
];
result
=
value
.
apply
(
obj
,
authorizations
);
if
(
result
===
true
)
status
=
true
;
}
}
else
{
if
(
Array
.
isArray
(
authorizations
))
{
var
i
;
for
(
i
=
0
;
i
<
authorizations
.
length
;
i
++
)
{
var
auth
=
authorizations
[
i
];
log
(
auth
);
for
(
key
in
this
.
authz
)
{
var
value
=
this
.
authz
[
key
];
if
(
typeof
value
!==
'undefined'
)
{
result
=
value
.
apply
(
obj
,
authorizations
);
if
(
result
===
true
)
status
=
true
;
}
}
}
}
}
return
status
;
};
/**
* ApiKeyAuthorization allows a query param or header to be injected
*/
var
ApiKeyAuthorization
=
function
(
name
,
value
,
type
)
{
this
.
name
=
name
;
this
.
value
=
value
;
this
.
type
=
type
;
};
ApiKeyAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
if
(
this
.
type
===
"query"
)
{
if
(
obj
.
url
.
indexOf
(
'?'
)
>
0
)
obj
.
url
=
obj
.
url
+
"&"
+
this
.
name
+
"="
+
this
.
value
;
else
obj
.
url
=
obj
.
url
+
"?"
+
this
.
name
+
"="
+
this
.
value
;
return
true
;
}
else
if
(
this
.
type
===
"header"
)
{
obj
.
headers
[
this
.
name
]
=
this
.
value
;
return
true
;
}
};
var
CookieAuthorization
=
function
(
cookie
)
{
this
.
cookie
=
cookie
;
}
CookieAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
obj
.
cookieJar
=
obj
.
cookieJar
||
CookieJar
();
obj
.
cookieJar
.
setCookie
(
this
.
cookie
);
return
true
;
}
/**
* Password Authorization is a basic auth implementation
*/
var
PasswordAuthorization
=
function
(
name
,
username
,
password
)
{
this
.
name
=
name
;
this
.
username
=
username
;
this
.
password
=
password
;
this
.
_btoa
=
null
;
if
(
typeof
window
!==
'undefined'
)
this
.
_btoa
=
btoa
;
else
this
.
_btoa
=
require
(
"btoa"
);
};
PasswordAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
var
base64encoder
=
this
.
_btoa
;
obj
.
headers
[
"Authorization"
]
=
"Basic "
+
base64encoder
(
this
.
username
+
":"
+
this
.
password
);
return
true
;
};
var
__bind
=
function
(
fn
,
me
){
return
function
(){
return
fn
.
apply
(
me
,
arguments
);
};
};
fail
=
function
(
message
)
{
log
(
message
);
}
log
=
function
(){
log
.
history
=
log
.
history
||
[];
log
.
history
.
push
(
arguments
);
if
(
this
.
console
){
console
.
log
(
Array
.
prototype
.
slice
.
call
(
arguments
)[
0
]
);
}
};
if
(
!
Array
.
prototype
.
indexOf
)
{
Array
.
prototype
.
indexOf
=
function
(
obj
,
start
)
{
for
(
var
i
=
(
start
||
0
),
j
=
this
.
length
;
i
<
j
;
i
++
)
{
if
(
this
[
i
]
===
obj
)
{
return
i
;
}
}
return
-
1
;
}
}
if
(
!
(
'filter'
in
Array
.
prototype
))
{
Array
.
prototype
.
filter
=
function
(
filter
,
that
/*opt*/
)
{
var
other
=
[],
v
;
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
if
(
i
in
this
&&
filter
.
call
(
that
,
v
=
this
[
i
],
i
,
this
))
other
.
push
(
v
);
return
other
;
};
}
if
(
!
(
'map'
in
Array
.
prototype
))
{
Array
.
prototype
.
map
=
function
(
mapper
,
that
/*opt*/
)
{
var
other
=
new
Array
(
this
.
length
);
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
if
(
i
in
this
)
other
[
i
]
=
mapper
.
call
(
that
,
this
[
i
],
i
,
this
);
return
other
;
};
}
Object
.
keys
=
Object
.
keys
||
(
function
()
{
var
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
,
hasDontEnumBug
=
!
{
toString
:
null
}.
propertyIsEnumerable
(
"toString"
),
DontEnums
=
[
'toString'
,
'toLocaleString'
,
'valueOf'
,
'hasOwnProperty'
,
'isPrototypeOf'
,
'propertyIsEnumerable'
,
'constructor'
],
DontEnumsLength
=
DontEnums
.
length
;
return
function
(
o
)
{
if
(
typeof
o
!=
"object"
&&
typeof
o
!=
"function"
||
o
===
null
)
throw
new
TypeError
(
"Object.keys called on a non-object"
);
var
result
=
[];
for
(
var
name
in
o
)
{
if
(
hasOwnProperty
.
call
(
o
,
name
))
result
.
push
(
name
);
}
if
(
hasDontEnumBug
)
{
for
(
var
i
=
0
;
i
<
DontEnumsLength
;
i
++
)
{
if
(
hasOwnProperty
.
call
(
o
,
DontEnums
[
i
]))
result
.
push
(
DontEnums
[
i
]);
}
}
return
result
;
};
})();
/**
* PrimitiveModel
**/
var
PrimitiveModel
=
function
(
definition
)
{
this
.
name
=
"name"
;
this
.
definition
=
definition
||
{};
this
.
properties
=
[];
this
.
type
;
var
requiredFields
=
definition
.
enum
||
[];
this
.
type
=
typeFromJsonSchema
(
definition
.
type
,
definition
.
format
);
}
PrimitiveModel
.
prototype
.
createJSONSample
=
function
(
modelsToIgnore
)
{
var
result
=
this
.
type
;
return
result
;
};
PrimitiveModel
.
prototype
.
getSampleValue
=
function
()
{
var
result
=
this
.
type
;
return
null
;
}
PrimitiveModel
.
prototype
.
getMockSignature
=
function
(
modelsToIgnore
)
{
var
propertiesStr
=
[];
var
i
;
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
prop
=
this
.
properties
[
i
];
propertiesStr
.
push
(
prop
.
toString
());
}
var
strong
=
'<span class="strong">'
;
var
stronger
=
'<span class="stronger">'
;
var
strongClose
=
'</span>'
;
var
classOpen
=
strong
+
this
.
name
+
' {'
+
strongClose
;
var
classClose
=
strong
+
'}'
+
strongClose
;
var
returnVal
=
classOpen
+
'<div>'
+
propertiesStr
.
join
(
',</div><div>'
)
+
'</div>'
+
classClose
;
if
(
!
modelsToIgnore
)
modelsToIgnore
=
{};
modelsToIgnore
[
this
.
name
]
=
this
;
var
i
;
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
prop
=
this
.
properties
[
i
];
var
ref
=
prop
[
'$ref'
];
var
model
=
models
[
ref
];
if
(
model
&&
typeof
modelsToIgnore
[
ref
]
===
'undefined'
)
{
returnVal
=
returnVal
+
(
'<br>'
+
model
.
getMockSignature
(
modelsToIgnore
));
}
}
return
returnVal
;
};
var
SwaggerClient
=
function
(
url
,
options
)
{
this
.
isBuilt
=
false
;
this
.
url
=
null
;
this
.
debug
=
false
;
this
.
basePath
=
null
;
this
.
authorizations
=
null
;
this
.
authorizationScheme
=
null
;
this
.
isValid
=
false
;
this
.
info
=
null
;
this
.
useJQuery
=
false
;
this
.
models
=
models
;
options
=
(
options
||
{});
if
(
url
)
if
(
url
.
url
)
options
=
url
;
else
this
.
url
=
url
;
else
options
=
url
;
if
(
options
.
url
!=
null
)
this
.
url
=
options
.
url
;
if
(
options
.
success
!=
null
)
this
.
success
=
options
.
success
;
if
(
typeof
options
.
useJQuery
===
'boolean'
)
this
.
useJQuery
=
options
.
useJQuery
;
this
.
failure
=
options
.
failure
!=
null
?
options
.
failure
:
function
()
{};
this
.
progress
=
options
.
progress
!=
null
?
options
.
progress
:
function
()
{};
this
.
spec
=
options
.
spec
;
if
(
options
.
success
!=
null
)
this
.
build
();
}
SwaggerClient
.
prototype
.
build
=
function
()
{
var
self
=
this
;
this
.
progress
(
'fetching resource list: '
+
this
.
url
);
var
obj
=
{
useJQuery
:
this
.
useJQuery
,
url
:
this
.
url
,
method
:
"get"
,
headers
:
{
accept
:
"application/json, */*"
},
on
:
{
error
:
function
(
response
)
{
if
(
self
.
url
.
substring
(
0
,
4
)
!==
'http'
)
return
self
.
fail
(
'Please specify the protocol for '
+
self
.
url
);
else
if
(
response
.
status
===
0
)
return
self
.
fail
(
'Can\'t read from server. It may not have the appropriate access-control-origin settings.'
);
else
if
(
response
.
status
===
404
)
return
self
.
fail
(
'Can\'t read swagger JSON from '
+
self
.
url
);
else
return
self
.
fail
(
response
.
status
+
' : '
+
response
.
statusText
+
' '
+
self
.
url
);
},
response
:
function
(
resp
)
{
var
responseObj
=
resp
.
obj
||
JSON
.
parse
(
resp
.
data
);
self
.
swaggerVersion
=
responseObj
.
swaggerVersion
;
if
(
responseObj
.
swagger
&&
parseInt
(
responseObj
.
swagger
)
===
2
)
{
self
.
swaggerVersion
=
responseObj
.
swagger
;
self
.
buildFromSpec
(
responseObj
);
self
.
isValid
=
true
;
}
else
{
self
.
isValid
=
false
;
self
.
failure
();
}
}
}
};
if
(
this
.
spec
)
{
var
self
=
this
;
setTimeout
(
function
()
{
self
.
buildFromSpec
(
self
.
spec
);
},
10
);
}
else
{
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
var
status
=
e
.
authorizations
.
apply
(
obj
);
new
SwaggerHttp
().
execute
(
obj
);
}
return
this
;
};
SwaggerClient
.
prototype
.
buildFromSpec
=
function
(
response
)
{
if
(
this
.
isBuilt
)
return
this
;
this
.
info
=
response
.
info
||
{};
this
.
title
=
response
.
title
||
''
;
this
.
host
=
response
.
host
||
''
;
this
.
schemes
=
response
.
schemes
||
[];
this
.
scheme
;
this
.
basePath
=
response
.
basePath
||
''
;
this
.
apis
=
{};
this
.
apisArray
=
[];
this
.
consumes
=
response
.
consumes
;
this
.
produces
=
response
.
produces
;
this
.
securityDefinitions
=
response
.
securityDefinitions
;
// legacy support
this
.
authSchemes
=
response
.
securityDefinitions
;
var
location
=
this
.
parseUri
(
this
.
url
);
if
(
typeof
this
.
schemes
===
'undefined'
||
this
.
schemes
.
length
===
0
)
{
this
.
scheme
=
location
.
scheme
;
}
else
{
this
.
scheme
=
this
.
schemes
[
0
];
}
if
(
typeof
this
.
host
===
'undefined'
||
this
.
host
===
''
)
{
this
.
host
=
location
.
host
;
if
(
location
.
port
)
{
this
.
host
=
this
.
host
+
':'
+
location
.
port
;
}
}
this
.
definitions
=
response
.
definitions
;
var
key
;
for
(
key
in
this
.
definitions
)
{
var
model
=
new
Model
(
key
,
this
.
definitions
[
key
]);
if
(
model
)
{
models
[
key
]
=
model
;
}
}
// get paths, create functions for each operationId
var
path
;
var
operations
=
[];
for
(
path
in
response
.
paths
)
{
if
(
typeof
response
.
paths
[
path
]
===
'object'
)
{
var
httpMethod
;
for
(
httpMethod
in
response
.
paths
[
path
])
{
if
([
'delete'
,
'get'
,
'head'
,
'options'
,
'patch'
,
'post'
,
'put'
].
indexOf
(
httpMethod
)
===
-
1
)
{
continue
;
}
var
operation
=
response
.
paths
[
path
][
httpMethod
];
var
tags
=
operation
.
tags
;
if
(
typeof
tags
===
'undefined'
)
{
operation
.
tags
=
[
'default'
];
tags
=
operation
.
tags
;
}
var
operationId
=
this
.
idFromOp
(
path
,
httpMethod
,
operation
);
var
operationObject
=
new
Operation
(
this
,
operationId
,
httpMethod
,
path
,
operation
,
this
.
definitions
);
// bind this operation's execute command to the api
if
(
tags
.
length
>
0
)
{
var
i
;
for
(
i
=
0
;
i
<
tags
.
length
;
i
++
)
{
var
tag
=
this
.
tagFromLabel
(
tags
[
i
]);
var
operationGroup
=
this
[
tag
];
if
(
typeof
operationGroup
===
'undefined'
)
{
this
[
tag
]
=
[];
operationGroup
=
this
[
tag
];
operationGroup
.
label
=
tag
;
operationGroup
.
apis
=
[];
this
[
tag
].
help
=
this
.
help
.
bind
(
operationGroup
);
this
.
apisArray
.
push
(
new
OperationGroup
(
tag
,
operationObject
));
}
operationGroup
[
operationId
]
=
operationObject
.
execute
.
bind
(
operationObject
);
operationGroup
[
operationId
].
help
=
operationObject
.
help
.
bind
(
operationObject
);
operationGroup
.
apis
.
push
(
operationObject
);
// legacy UI feature
var
j
;
var
api
;
for
(
j
=
0
;
j
<
this
.
apisArray
.
length
;
j
++
)
{
if
(
this
.
apisArray
[
j
].
tag
===
tag
)
{
api
=
this
.
apisArray
[
j
];
}
}
if
(
api
)
{
api
.
operationsArray
.
push
(
operationObject
);
}
}
}
else
{
log
(
'no group to bind to'
);
}
}
}
}
this
.
isBuilt
=
true
;
if
(
this
.
success
)
this
.
success
();
return
this
;
}
SwaggerClient
.
prototype
.
parseUri
=
function
(
uri
)
{
var
urlParseRE
=
/^
(((([^
:
\/
#
\?]
+:
)?(?:(\/\/)((?:(([^
:@
\/
#
\?]
+
)(?:\:([^
:@
\/
#
\?]
+
))?)
@
)?(([^
:
\/
#
\?\]\[]
+|
\[[^\/\]
@#?
]
+
\])(?:\:([
0-9
]
+
))?))?)?)?((\/?(?:[^\/\?
#
]
+
\/
+
)
*
)([^\?
#
]
*
)))?(\?[^
#
]
+
)?)(
#.*
)?
/
;
var
parts
=
urlParseRE
.
exec
(
uri
);
return
{
scheme
:
parts
[
4
].
replace
(
':'
,
''
),
host
:
parts
[
11
],
port
:
parts
[
12
],
path
:
parts
[
15
]
};
}
SwaggerClient
.
prototype
.
help
=
function
()
{
var
i
;
log
(
'operations for the "'
+
this
.
label
+
'" tag'
);
for
(
i
=
0
;
i
<
this
.
apis
.
length
;
i
++
)
{
var
api
=
this
.
apis
[
i
];
log
(
' * '
+
api
.
nickname
+
': '
+
api
.
operation
.
summary
);
}
}
SwaggerClient
.
prototype
.
tagFromLabel
=
function
(
label
)
{
return
label
;
}
SwaggerClient
.
prototype
.
idFromOp
=
function
(
path
,
httpMethod
,
op
)
{
if
(
typeof
op
.
operationId
!==
'undefined'
)
{
return
(
op
.
operationId
);
}
else
{
return
path
.
substring
(
1
)
.
replace
(
/
\/
/g
,
"_"
)
.
replace
(
/
\{
/g
,
""
)
.
replace
(
/
\}
/g
,
""
)
.
replace
(
/
\.
/g
,
"_"
)
+
"_"
+
httpMethod
;
}
}
SwaggerClient
.
prototype
.
fail
=
function
(
message
)
{
this
.
failure
(
message
);
throw
message
;
};
var
OperationGroup
=
function
(
tag
,
operation
)
{
this
.
tag
=
tag
;
this
.
path
=
tag
;
this
.
name
=
tag
;
this
.
operation
=
operation
;
this
.
operationsArray
=
[];
this
.
description
=
operation
.
description
||
""
;
}
var
Operation
=
function
(
parent
,
operationId
,
httpMethod
,
path
,
args
,
definitions
)
{
var
errors
=
[];
parent
=
parent
||
{};
args
=
args
||
{};
this
.
operation
=
args
;
this
.
deprecated
=
args
.
deprecated
;
this
.
consumes
=
args
.
consumes
;
this
.
produces
=
args
.
produces
;
this
.
parent
=
parent
;
this
.
host
=
parent
.
host
||
'localhost'
;
this
.
schemes
=
parent
.
schemes
;
this
.
scheme
=
parent
.
scheme
||
'http'
;
this
.
basePath
=
parent
.
basePath
||
'/'
;
this
.
nickname
=
(
operationId
||
errors
.
push
(
'Operations must have a nickname.'
));
this
.
method
=
(
httpMethod
||
errors
.
push
(
'Operation '
+
operationId
+
' is missing method.'
));
this
.
path
=
(
path
||
errors
.
push
(
'Operation '
+
this
.
nickname
+
' is missing path.'
));
this
.
parameters
=
args
!=
null
?
(
args
.
parameters
||
[])
:
{};
this
.
summary
=
args
.
summary
||
''
;
this
.
responses
=
(
args
.
responses
||
{});
this
.
type
=
null
;
this
.
security
=
args
.
security
;
this
.
authorizations
=
args
.
security
;
this
.
description
=
args
.
description
;
var
i
;
for
(
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
param
.
type
===
'array'
)
{
param
.
isList
=
true
;
param
.
allowMultiple
=
true
;
}
var
innerType
=
this
.
getType
(
param
);
if
(
innerType
&&
innerType
.
toString
().
toLowerCase
()
===
'boolean'
)
{
param
.
allowableValues
=
{};
param
.
isList
=
true
;
param
.
enum
=
[
"true"
,
"false"
];
}
if
(
typeof
param
.
enum
!==
'undefined'
)
{
var
id
;
param
.
allowableValues
=
{};
param
.
allowableValues
.
values
=
[];
param
.
allowableValues
.
descriptiveValues
=
[];
for
(
id
=
0
;
id
<
param
.
enum
.
length
;
id
++
)
{
var
value
=
param
.
enum
[
id
];
var
isDefault
=
(
value
===
param
.
default
)
?
true
:
false
;
param
.
allowableValues
.
values
.
push
(
value
);
param
.
allowableValues
.
descriptiveValues
.
push
({
value
:
value
,
isDefault
:
isDefault
});
}
}
if
(
param
.
type
===
'array'
&&
typeof
param
.
allowableValues
===
'undefined'
)
{
// can't show as a list if no values to select from
delete
param
.
isList
;
delete
param
.
allowMultiple
;
}
param
.
signature
=
this
.
getSignature
(
innerType
,
models
);
param
.
sampleJSON
=
this
.
getSampleJSON
(
innerType
,
models
);
param
.
responseClassSignature
=
param
.
signature
;
}
var
response
;
var
model
;
var
responses
=
this
.
responses
;
if
(
responses
[
'200'
])
{
response
=
responses
[
'200'
];
defaultResponseCode
=
'200'
;
}
else
if
(
responses
[
'201'
])
{
response
=
responses
[
'201'
];
defaultResponseCode
=
'201'
;
}
else
if
(
responses
[
'202'
])
{
response
=
responses
[
'202'
];
defaultResponseCode
=
'202'
;
}
else
if
(
responses
[
'203'
])
{
response
=
responses
[
'203'
];
defaultResponseCode
=
'203'
;
}
else
if
(
responses
[
'204'
])
{
response
=
responses
[
'204'
];
defaultResponseCode
=
'204'
;
}
else
if
(
responses
[
'205'
])
{
response
=
responses
[
'205'
];
defaultResponseCode
=
'205'
;
}
else
if
(
responses
[
'206'
])
{
response
=
responses
[
'206'
];
defaultResponseCode
=
'206'
;
}
else
if
(
responses
[
'default'
])
{
response
=
responses
[
'default'
];
defaultResponseCode
=
'default'
;
}
if
(
response
&&
response
.
schema
)
{
var
resolvedModel
=
this
.
resolveModel
(
response
.
schema
,
definitions
);
if
(
resolvedModel
)
{
this
.
type
=
resolvedModel
.
name
;
this
.
responseSampleJSON
=
JSON
.
stringify
(
resolvedModel
.
getSampleValue
(),
null
,
2
);
this
.
responseClassSignature
=
resolvedModel
.
getMockSignature
();
delete
responses
[
defaultResponseCode
];
}
else
{
this
.
type
=
response
.
schema
.
type
;
}
}
if
(
errors
.
length
>
0
)
{
if
(
this
.
resource
&&
this
.
resource
.
api
&&
this
.
resource
.
api
.
fail
)
this
.
resource
.
api
.
fail
(
errors
);
}
return
this
;
}
OperationGroup
.
prototype
.
sort
=
function
(
sorter
)
{
}
Operation
.
prototype
.
getType
=
function
(
param
)
{
var
type
=
param
.
type
;
var
format
=
param
.
format
;
var
isArray
=
false
;
var
str
;
if
(
type
===
'integer'
&&
format
===
'int32'
)
str
=
'integer'
;
else
if
(
type
===
'integer'
&&
format
===
'int64'
)
str
=
'long'
;
else
if
(
type
===
'integer'
)
str
=
'integer'
else
if
(
type
===
'string'
&&
format
===
'date-time'
)
str
=
'date-time'
;
else
if
(
type
===
'string'
&&
format
===
'date'
)
str
=
'date'
;
else
if
(
type
===
'number'
&&
format
===
'float'
)
str
=
'float'
;
else
if
(
type
===
'number'
&&
format
===
'double'
)
str
=
'double'
;
else
if
(
type
===
'number'
)
str
=
'double'
;
else
if
(
type
===
'boolean'
)
str
=
'boolean'
;
else
if
(
type
===
'string'
)
str
=
'string'
;
else
if
(
type
===
'array'
)
{
isArray
=
true
;
if
(
param
.
items
)
str
=
this
.
getType
(
param
.
items
);
}
if
(
param
[
'$ref'
])
str
=
param
[
'$ref'
];
var
schema
=
param
.
schema
;
if
(
schema
)
{
var
ref
=
schema
[
'$ref'
];
if
(
ref
)
{
ref
=
simpleRef
(
ref
);
if
(
isArray
)
return
[
ref
];
else
return
ref
;
}
else
return
this
.
getType
(
schema
);
}
if
(
isArray
)
return
[
str
];
else
return
str
;
}
Operation
.
prototype
.
resolveModel
=
function
(
schema
,
definitions
)
{
if
(
typeof
schema
[
'$ref'
]
!==
'undefined'
)
{
var
ref
=
schema
[
'$ref'
];
if
(
ref
.
indexOf
(
'#/definitions/'
)
==
0
)
ref
=
ref
.
substring
(
'#/definitions/'
.
length
);
if
(
definitions
[
ref
])
return
new
Model
(
ref
,
definitions
[
ref
]);
}
if
(
schema
.
type
===
'array'
)
return
new
ArrayModel
(
schema
);
else
return
null
;
}
Operation
.
prototype
.
help
=
function
(
dontPrint
)
{
var
out
=
this
.
nickname
+
': '
+
this
.
summary
+
'\n'
;
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
var
typeInfo
=
typeFromJsonSchema
(
param
.
type
,
param
.
format
);
out
+=
'\n * '
+
param
.
name
+
' ('
+
typeInfo
+
'): '
+
param
.
description
;
}
if
(
typeof
dontPrint
===
'undefined'
)
log
(
out
);
return
out
;
}
Operation
.
prototype
.
getSignature
=
function
(
type
,
models
)
{
var
isPrimitive
,
listType
;
if
(
type
instanceof
Array
)
{
listType
=
true
;
type
=
type
[
0
];
}
if
(
type
===
'string'
)
isPrimitive
=
true
else
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
type
]
!=
null
)
?
false
:
true
;
if
(
isPrimitive
)
{
return
type
;
}
else
{
if
(
listType
!=
null
)
return
models
[
type
].
getMockSignature
();
else
return
models
[
type
].
getMockSignature
();
}
};
Operation
.
prototype
.
supportHeaderParams
=
function
()
{
return
true
;
};
Operation
.
prototype
.
supportedSubmitMethods
=
function
()
{
return
this
.
resource
.
api
.
supportedSubmitMethods
;
};
Operation
.
prototype
.
getHeaderParams
=
function
(
args
)
{
var
headers
=
this
.
setContentTypes
(
args
,
{});
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
if
(
param
.
in
===
'header'
)
{
var
value
=
args
[
param
.
name
];
if
(
Array
.
isArray
(
value
))
value
=
this
.
encodePathCollection
(
param
.
collectionFormat
,
param
.
name
,
value
);
else
value
=
this
.
encodePathParam
(
value
);
headers
[
param
.
name
]
=
value
;
}
}
}
return
headers
;
}
Operation
.
prototype
.
urlify
=
function
(
args
)
{
var
formParams
=
{};
var
requestUrl
=
this
.
path
;
// grab params from the args, build the querystring along the way
var
querystring
=
''
;
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
if
(
param
.
in
===
'path'
)
{
var
reg
=
new
RegExp
(
'\{'
+
param
.
name
+
'[^\}]*\}'
,
'gi'
);
var
value
=
args
[
param
.
name
];
if
(
Array
.
isArray
(
value
))
value
=
this
.
encodePathCollection
(
param
.
collectionFormat
,
param
.
name
,
value
);
else
value
=
this
.
encodePathParam
(
value
);
requestUrl
=
requestUrl
.
replace
(
reg
,
value
);
}
else
if
(
param
.
in
===
'query'
&&
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
if
(
querystring
===
''
)
querystring
+=
'?'
;
else
querystring
+=
'&'
;
if
(
typeof
param
.
collectionFormat
!==
'undefined'
)
{
var
qp
=
args
[
param
.
name
];
if
(
Array
.
isArray
(
qp
))
querystring
+=
this
.
encodeQueryCollection
(
param
.
collectionFormat
,
param
.
name
,
qp
);
else
querystring
+=
this
.
encodeQueryParam
(
param
.
name
)
+
'='
+
this
.
encodeQueryParam
(
args
[
param
.
name
]);
}
else
querystring
+=
this
.
encodeQueryParam
(
param
.
name
)
+
'='
+
this
.
encodeQueryParam
(
args
[
param
.
name
]);
}
else
if
(
param
.
in
===
'formData'
)
formParams
[
param
.
name
]
=
args
[
param
.
name
];
}
}
var
url
=
this
.
scheme
+
'://'
+
this
.
host
;
if
(
this
.
basePath
!==
'/'
)
url
+=
this
.
basePath
;
return
url
+
requestUrl
+
querystring
;
}
Operation
.
prototype
.
getMissingParams
=
function
(
args
)
{
var
missingParams
=
[];
// check required params, track the ones that are missing
var
i
;
for
(
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
param
.
required
===
true
)
{
if
(
typeof
args
[
param
.
name
]
===
'undefined'
)
missingParams
=
param
.
name
;
}
}
return
missingParams
;
}
Operation
.
prototype
.
getBody
=
function
(
headers
,
args
)
{
var
formParams
=
{};
var
body
;
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
if
(
param
.
in
===
'body'
)
body
=
args
[
param
.
name
];
}
}
// handle form params
if
(
headers
[
'Content-Type'
]
===
'application/x-www-form-urlencoded'
)
{
var
encoded
=
""
;
var
key
;
for
(
key
in
formParams
)
{
value
=
formParams
[
key
];
if
(
typeof
value
!==
'undefined'
){
if
(
encoded
!==
""
)
encoded
+=
"&"
;
encoded
+=
encodeURIComponent
(
key
)
+
'='
+
encodeURIComponent
(
value
);
}
}
body
=
encoded
;
}
return
body
;
}
/**
* gets sample response for a single operation
**/
Operation
.
prototype
.
getSampleJSON
=
function
(
type
,
models
)
{
var
isPrimitive
,
listType
,
sampleJson
;
listType
=
(
type
instanceof
Array
);
isPrimitive
=
(
models
[
type
]
!=
null
)
?
false
:
true
;
sampleJson
=
isPrimitive
?
void
0
:
models
[
type
].
createJSONSample
();
if
(
sampleJson
)
{
sampleJson
=
listType
?
[
sampleJson
]
:
sampleJson
;
if
(
typeof
sampleJson
==
'string'
)
return
sampleJson
;
else
if
(
typeof
sampleJson
===
'object'
)
{
var
t
=
sampleJson
;
if
(
sampleJson
instanceof
Array
&&
sampleJson
.
length
>
0
)
{
t
=
sampleJson
[
0
];
}
if
(
t
.
nodeName
)
{
var
xmlString
=
new
XMLSerializer
().
serializeToString
(
t
);
return
this
.
formatXml
(
xmlString
);
}
else
return
JSON
.
stringify
(
sampleJson
,
null
,
2
);
}
else
return
sampleJson
;
}
}
/**
* legacy binding
**/
Operation
.
prototype
[
"do"
]
=
function
(
args
,
opts
,
callback
,
error
,
parent
)
{
return
this
.
execute
(
args
,
opts
,
callback
,
error
,
parent
);
}
/**
* executes an operation
**/
Operation
.
prototype
.
execute
=
function
(
arg1
,
arg2
,
arg3
,
arg4
,
parent
)
{
var
args
=
arg1
||
{};
var
opts
=
{},
success
,
error
;
if
(
typeof
arg2
===
'object'
)
{
opts
=
arg2
;
success
=
arg3
;
error
=
arg4
;
}
if
(
typeof
arg2
===
'function'
)
{
success
=
arg2
;
error
=
arg3
;
}
success
=
(
success
||
log
)
error
=
(
error
||
log
)
var
missingParams
=
this
.
getMissingParams
(
args
);
if
(
missingParams
.
length
>
0
)
{
var
message
=
'missing required params: '
+
missingParams
;
fail
(
message
);
return
;
}
var
headers
=
this
.
getHeaderParams
(
args
);
var
body
=
this
.
getBody
(
headers
,
args
);
var
url
=
this
.
urlify
(
args
)
var
obj
=
{
url
:
url
,
method
:
this
.
method
,
body
:
body
,
useJQuery
:
this
.
useJQuery
,
headers
:
headers
,
on
:
{
response
:
function
(
response
)
{
return
success
(
response
,
parent
);
},
error
:
function
(
response
)
{
return
error
(
response
,
parent
);
}
}
};
var
status
=
e
.
authorizations
.
apply
(
obj
,
this
.
operation
.
security
);
new
SwaggerHttp
().
execute
(
obj
);
}
Operation
.
prototype
.
setContentTypes
=
function
(
args
,
opts
)
{
// default type
var
accepts
=
'application/json'
;
var
consumes
=
args
.
parameterContentType
||
'application/json'
;
var
allDefinedParams
=
this
.
parameters
;
var
definedFormParams
=
[];
var
definedFileParams
=
[];
var
body
;
var
headers
=
{};
// get params from the operation and set them in definedFileParams, definedFormParams, headers
var
i
;
for
(
i
=
0
;
i
<
allDefinedParams
.
length
;
i
++
)
{
var
param
=
allDefinedParams
[
i
];
if
(
param
.
in
===
'formData'
)
{
if
(
param
.
type
===
'file'
)
definedFileParams
.
push
(
param
);
else
definedFormParams
.
push
(
param
);
}
else
if
(
param
.
in
===
'header'
&&
this
.
headers
)
{
var
key
=
param
.
name
;
var
headerValue
=
this
.
headers
[
param
.
name
];
if
(
typeof
this
.
headers
[
param
.
name
]
!==
'undefined'
)
headers
[
key
]
=
headerValue
;
}
else
if
(
param
.
in
===
'body'
&&
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
body
=
args
[
param
.
name
];
}
}
// if there's a body, need to set the consumes header via requestContentType
if
(
body
&&
(
this
.
method
===
'post'
||
this
.
method
===
'put'
||
this
.
method
===
'patch'
||
this
.
method
===
'delete'
))
{
if
(
opts
.
requestContentType
)
consumes
=
opts
.
requestContentType
;
}
else
{
// if any form params, content type must be set
if
(
definedFormParams
.
length
>
0
)
{
if
(
opts
.
requestContentType
)
// override if set
consumes
=
opts
.
requestContentType
;
else
if
(
definedFileParams
.
length
>
0
)
// if a file, must be multipart/form-data
consumes
=
'multipart/form-data'
;
else
// default to x-www-from-urlencoded
consumes
=
'application/x-www-form-urlencoded'
;
}
else
if
(
this
.
type
==
'DELETE'
)
body
=
'{}'
;
else
if
(
this
.
type
!=
'DELETE'
)
consumes
=
null
;
}
if
(
consumes
&&
this
.
consumes
)
{
if
(
this
.
consumes
.
indexOf
(
consumes
)
===
-
1
)
{
log
(
'server doesn\'t consume '
+
consumes
+
', try '
+
JSON
.
stringify
(
this
.
consumes
));
consumes
=
this
.
operation
.
consumes
[
0
];
}
}
if
(
opts
.
responseContentType
)
{
accepts
=
opts
.
responseContentType
;
}
else
{
accepts
=
'application/json'
;
}
if
(
accepts
&&
this
.
produces
)
{
if
(
this
.
produces
.
indexOf
(
accepts
)
===
-
1
)
{
log
(
'server can\'t produce '
+
accepts
);
accepts
=
this
.
produces
[
0
];
}
}
if
((
consumes
&&
body
!==
''
)
||
(
consumes
===
'application/x-www-form-urlencoded'
))
headers
[
'Content-Type'
]
=
consumes
;
if
(
accepts
)
headers
[
'Accept'
]
=
accepts
;
return
headers
;
}
Operation
.
prototype
.
asCurl
=
function
(
args
)
{
var
results
=
[];
var
headers
=
this
.
getHeaderParams
(
args
);
if
(
headers
)
{
var
key
;
for
(
key
in
headers
)
results
.
push
(
"--header \""
+
key
+
": "
+
headers
[
key
]
+
"\""
);
}
return
"curl "
+
(
results
.
join
(
" "
))
+
" "
+
this
.
urlify
(
args
);
}
Operation
.
prototype
.
encodePathCollection
=
function
(
type
,
name
,
value
)
{
var
encoded
=
''
;
var
i
;
var
separator
=
''
;
if
(
type
===
'ssv'
)
separator
=
'%20'
;
else
if
(
type
===
'tsv'
)
separator
=
'\\t'
;
else
if
(
type
===
'pipes'
)
separator
=
'|'
;
else
separator
=
','
;
for
(
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
i
==
0
)
encoded
=
this
.
encodeQueryParam
(
value
[
i
]);
else
encoded
+=
separator
+
this
.
encodeQueryParam
(
value
[
i
]);
}
return
encoded
;
}
Operation
.
prototype
.
encodeQueryCollection
=
function
(
type
,
name
,
value
)
{
var
encoded
=
''
;
var
i
;
if
(
type
===
'default'
||
type
===
'multi'
)
{
for
(
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
i
>
0
)
encoded
+=
'&'
encoded
+=
this
.
encodeQueryParam
(
name
)
+
'='
+
this
.
encodeQueryParam
(
value
[
i
]);
}
}
else
{
var
separator
=
''
;
if
(
type
===
'csv'
)
separator
=
','
;
else
if
(
type
===
'ssv'
)
separator
=
'%20'
;
else
if
(
type
===
'tsv'
)
separator
=
'\\t'
;
else
if
(
type
===
'pipes'
)
separator
=
'|'
;
else
if
(
type
===
'brackets'
)
{
for
(
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
i
!==
0
)
encoded
+=
'&'
;
encoded
+=
this
.
encodeQueryParam
(
name
)
+
'[]='
+
this
.
encodeQueryParam
(
value
[
i
]);
}
}
if
(
separator
!==
''
)
{
for
(
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
i
==
0
)
encoded
=
this
.
encodeQueryParam
(
name
)
+
'='
+
this
.
encodeQueryParam
(
value
[
i
]);
else
encoded
+=
separator
+
this
.
encodeQueryParam
(
value
[
i
]);
}
}
}
return
encoded
;
}
/**
* TODO this encoding needs to be changed
**/
Operation
.
prototype
.
encodeQueryParam
=
function
(
arg
)
{
return
escape
(
arg
);
}
/**
* TODO revisit, might not want to leave '/'
**/
Operation
.
prototype
.
encodePathParam
=
function
(
pathParam
)
{
var
encParts
,
part
,
parts
,
i
,
len
;
pathParam
=
pathParam
.
toString
();
if
(
pathParam
.
indexOf
(
'/'
)
===
-
1
)
{
return
encodeURIComponent
(
pathParam
);
}
else
{
parts
=
pathParam
.
split
(
'/'
);
encParts
=
[];
for
(
i
=
0
,
len
=
parts
.
length
;
i
<
len
;
i
++
)
{
encParts
.
push
(
encodeURIComponent
(
parts
[
i
]));
}
return
encParts
.
join
(
'/'
);
}
};
var
Model
=
function
(
name
,
definition
)
{
this
.
name
=
name
;
this
.
definition
=
definition
||
{};
this
.
properties
=
[];
var
requiredFields
=
definition
.
required
||
[];
var
key
;
var
props
=
definition
.
properties
;
if
(
props
)
{
for
(
key
in
props
)
{
var
required
=
false
;
var
property
=
props
[
key
];
if
(
requiredFields
.
indexOf
(
key
)
>=
0
)
required
=
true
;
this
.
properties
.
push
(
new
Property
(
key
,
property
,
required
));
}
}
}
Model
.
prototype
.
createJSONSample
=
function
(
modelsToIgnore
)
{
var
result
=
{};
modelsToIgnore
=
(
modelsToIgnore
||
{})
modelsToIgnore
[
this
.
name
]
=
this
;
var
i
;
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
prop
=
this
.
properties
[
i
];
result
[
prop
.
name
]
=
prop
.
getSampleValue
(
modelsToIgnore
);
}
delete
modelsToIgnore
[
this
.
name
];
return
result
;
};
Model
.
prototype
.
getSampleValue
=
function
(
modelsToIgnore
)
{
var
i
;
var
obj
=
{};
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
property
=
this
.
properties
[
i
];
obj
[
property
.
name
]
=
property
.
sampleValue
(
false
,
modelsToIgnore
);
}
return
obj
;
}
Model
.
prototype
.
getMockSignature
=
function
(
modelsToIgnore
)
{
var
propertiesStr
=
[];
var
i
;
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
prop
=
this
.
properties
[
i
];
propertiesStr
.
push
(
prop
.
toString
());
}
var
strong
=
'<span class="strong">'
;
var
stronger
=
'<span class="stronger">'
;
var
strongClose
=
'</span>'
;
var
classOpen
=
strong
+
this
.
name
+
' {'
+
strongClose
;
var
classClose
=
strong
+
'}'
+
strongClose
;
var
returnVal
=
classOpen
+
'<div>'
+
propertiesStr
.
join
(
',</div><div>'
)
+
'</div>'
+
classClose
;
if
(
!
modelsToIgnore
)
modelsToIgnore
=
{};
modelsToIgnore
[
this
.
name
]
=
this
;
var
i
;
for
(
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
prop
=
this
.
properties
[
i
];
var
ref
=
prop
[
'$ref'
];
var
model
=
models
[
ref
];
if
(
model
&&
typeof
modelsToIgnore
[
model
.
name
]
===
'undefined'
)
{
returnVal
=
returnVal
+
(
'<br>'
+
model
.
getMockSignature
(
modelsToIgnore
));
}
}
return
returnVal
;
};
var
Property
=
function
(
name
,
obj
,
required
)
{
this
.
schema
=
obj
;
this
.
required
=
required
;
if
(
obj
[
'$ref'
])
this
[
'$ref'
]
=
simpleRef
(
obj
[
'$ref'
]);
else
if
(
obj
.
type
===
'array'
)
{
if
(
obj
.
items
[
'$ref'
])
this
[
'$ref'
]
=
simpleRef
(
obj
.
items
[
'$ref'
]);
else
obj
=
obj
.
items
;
}
this
.
name
=
name
;
this
.
description
=
obj
.
description
;
this
.
obj
=
obj
;
this
.
optional
=
true
;
this
.
default
=
obj
.
default
||
null
;
this
.
example
=
obj
.
example
||
null
;
}
Property
.
prototype
.
getSampleValue
=
function
(
modelsToIgnore
)
{
return
this
.
sampleValue
(
false
,
modelsToIgnore
);
}
Property
.
prototype
.
isArray
=
function
()
{
var
schema
=
this
.
schema
;
if
(
schema
.
type
===
'array'
)
return
true
;
else
return
false
;
}
Property
.
prototype
.
sampleValue
=
function
(
isArray
,
ignoredModels
)
{
isArray
=
(
isArray
||
this
.
isArray
());
ignoredModels
=
(
ignoredModels
||
{});
var
type
=
getStringSignature
(
this
.
obj
);
var
output
;
if
(
this
[
'$ref'
])
{
var
refModelName
=
simpleRef
(
this
[
'$ref'
]);
var
refModel
=
models
[
refModelName
];
if
(
refModel
&&
typeof
ignoredModels
[
type
]
===
'undefined'
)
{
ignoredModels
[
type
]
=
this
;
output
=
refModel
.
getSampleValue
(
ignoredModels
);
}
else
type
=
refModel
;
}
else
if
(
this
.
example
)
output
=
this
.
example
;
else
if
(
this
.
default
)
output
=
this
.
default
;
else
if
(
type
===
'date-time'
)
output
=
new
Date
().
toISOString
();
else
if
(
type
===
'string'
)
output
=
'string'
;
else
if
(
type
===
'integer'
)
output
=
0
;
else
if
(
type
===
'long'
)
output
=
0
;
else
if
(
type
===
'float'
)
output
=
0.0
;
else
if
(
type
===
'double'
)
output
=
0.0
;
else
if
(
type
===
'boolean'
)
output
=
true
;
else
output
=
{};
ignoredModels
[
type
]
=
output
;
if
(
isArray
)
return
[
output
];
else
return
output
;
}
getStringSignature
=
function
(
obj
)
{
var
str
=
''
;
if
(
obj
.
type
===
'array'
)
{
obj
=
(
obj
.
items
||
obj
[
'$ref'
]
||
{});
str
+=
'Array['
;
}
if
(
obj
.
type
===
'integer'
&&
obj
.
format
===
'int32'
)
str
+=
'integer'
;
else
if
(
obj
.
type
===
'integer'
&&
obj
.
format
===
'int64'
)
str
+=
'long'
;
else
if
(
obj
.
type
===
'integer'
&&
typeof
obj
.
format
===
'undefined'
)
str
+=
'long'
;
else
if
(
obj
.
type
===
'string'
&&
obj
.
format
===
'date-time'
)
str
+=
'date-time'
;
else
if
(
obj
.
type
===
'string'
&&
obj
.
format
===
'date'
)
str
+=
'date'
;
else
if
(
obj
.
type
===
'number'
&&
obj
.
format
===
'float'
)
str
+=
'float'
;
else
if
(
obj
.
type
===
'number'
&&
obj
.
format
===
'double'
)
str
+=
'double'
;
else
if
(
obj
.
type
===
'number'
&&
typeof
obj
.
format
===
'undefined'
)
str
+=
'double'
;
else
if
(
obj
.
type
===
'boolean'
)
str
+=
'boolean'
;
else
if
(
obj
[
'$ref'
])
str
+=
simpleRef
(
obj
[
'$ref'
]);
else
str
+=
obj
.
type
;
if
(
obj
.
type
===
'array'
)
str
+=
']'
;
return
str
;
}
simpleRef
=
function
(
name
)
{
if
(
typeof
name
===
'undefined'
)
return
null
;
if
(
name
.
indexOf
(
"#/definitions/"
)
===
0
)
return
name
.
substring
(
'#/definitions/'
.
length
)
else
return
name
;
}
Property
.
prototype
.
toString
=
function
()
{
var
str
=
getStringSignature
(
this
.
obj
);
if
(
str
!==
''
)
{
str
=
'<span class="propName '
+
this
.
required
+
'">'
+
this
.
name
+
'</span> (<span class="propType">'
+
str
+
'</span>'
;
if
(
!
this
.
required
)
str
+=
', <span class="propOptKey">optional</span>'
;
str
+=
')'
;
}
else
str
=
this
.
name
+
' ('
+
JSON
.
stringify
(
this
.
obj
)
+
')'
;
if
(
typeof
this
.
description
!==
'undefined'
)
str
+=
': '
+
this
.
description
;
return
str
;
}
typeFromJsonSchema
=
function
(
type
,
format
)
{
var
str
;
if
(
type
===
'integer'
&&
format
===
'int32'
)
str
=
'integer'
;
else
if
(
type
===
'integer'
&&
format
===
'int64'
)
str
=
'long'
;
else
if
(
type
===
'integer'
&&
typeof
format
===
'undefined'
)
str
=
'long'
;
else
if
(
type
===
'string'
&&
format
===
'date-time'
)
str
=
'date-time'
;
else
if
(
type
===
'string'
&&
format
===
'date'
)
str
=
'date'
;
else
if
(
type
===
'number'
&&
format
===
'float'
)
str
=
'float'
;
else
if
(
type
===
'number'
&&
format
===
'double'
)
str
=
'double'
;
else
if
(
type
===
'number'
&&
typeof
format
===
'undefined'
)
str
=
'double'
;
else
if
(
type
===
'boolean'
)
str
=
'boolean'
;
else
if
(
type
===
'string'
)
str
=
'string'
;
return
str
;
}
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
var
sampleModels
=
{};
var
cookies
=
{};
var
models
=
{};
e
.
authorizations
=
new
SwaggerAuthorizations
();
e
.
ApiKeyAuthorization
=
ApiKeyAuthorization
;
e
.
PasswordAuthorization
=
PasswordAuthorization
;
e
.
CookieAuthorization
=
CookieAuthorization
;
e
.
SwaggerClient
=
SwaggerClient
;
e
.
Operation
=
Operation
;
/**
* SwaggerHttp is a wrapper for executing requests
*/
var
SwaggerHttp
=
function
()
{};
SwaggerHttp
.
prototype
.
execute
=
function
(
obj
)
{
if
(
obj
&&
(
typeof
obj
.
useJQuery
===
'boolean'
))
this
.
useJQuery
=
obj
.
useJQuery
;
else
this
.
useJQuery
=
this
.
isIE8
();
if
(
this
.
useJQuery
)
return
new
JQueryHttpClient
().
execute
(
obj
);
else
return
new
ShredHttpClient
().
execute
(
obj
);
}
SwaggerHttp
.
prototype
.
isIE8
=
function
()
{
var
detectedIE
=
false
;
if
(
typeof
navigator
!==
'undefined'
&&
navigator
.
userAgent
)
{
nav
=
navigator
.
userAgent
.
toLowerCase
();
if
(
nav
.
indexOf
(
'msie'
)
!==
-
1
)
{
var
version
=
parseInt
(
nav
.
split
(
'msie'
)[
1
]);
if
(
version
<=
8
)
{
detectedIE
=
true
;
}
}
}
return
detectedIE
;
};
/*
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
* Since we are using closures here we need to alias it for internal use.
*/
var
JQueryHttpClient
=
function
(
options
)
{
"use strict"
;
if
(
!
jQuery
){
var
jQuery
=
window
.
jQuery
;
}
}
JQueryHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
var
cb
=
obj
.
on
;
var
request
=
obj
;
obj
.
type
=
obj
.
method
;
obj
.
cache
=
false
;
obj
.
beforeSend
=
function
(
xhr
)
{
var
key
,
results
;
if
(
obj
.
headers
)
{
results
=
[];
var
key
;
for
(
key
in
obj
.
headers
)
{
if
(
key
.
toLowerCase
()
===
"content-type"
)
{
results
.
push
(
obj
.
contentType
=
obj
.
headers
[
key
]);
}
else
if
(
key
.
toLowerCase
()
===
"accept"
)
{
results
.
push
(
obj
.
accepts
=
obj
.
headers
[
key
]);
}
else
{
results
.
push
(
xhr
.
setRequestHeader
(
key
,
obj
.
headers
[
key
]));
}
}
return
results
;
}
};
obj
.
data
=
obj
.
body
;
obj
.
complete
=
function
(
response
,
textStatus
,
opts
)
{
var
headers
=
{},
headerArray
=
response
.
getAllResponseHeaders
().
split
(
"\n"
);
for
(
var
i
=
0
;
i
<
headerArray
.
length
;
i
++
)
{
var
toSplit
=
headerArray
[
i
].
trim
();
if
(
toSplit
.
length
===
0
)
continue
;
var
separator
=
toSplit
.
indexOf
(
":"
);
if
(
separator
===
-
1
)
{
// Name but no value in the header
headers
[
toSplit
]
=
null
;
continue
;
}
var
name
=
toSplit
.
substring
(
0
,
separator
).
trim
(),
value
=
toSplit
.
substring
(
separator
+
1
).
trim
();
headers
[
name
]
=
value
;
}
var
out
=
{
url
:
request
.
url
,
method
:
request
.
method
,
status
:
response
.
status
,
data
:
response
.
responseText
,
headers
:
headers
};
var
contentType
=
(
headers
[
"content-type"
]
||
headers
[
"Content-Type"
]
||
null
)
if
(
contentType
!=
null
)
{
if
(
contentType
.
indexOf
(
"application/json"
)
==
0
||
contentType
.
indexOf
(
"+json"
)
>
0
)
{
if
(
response
.
responseText
&&
response
.
responseText
!==
""
)
{
try
{
out
.
obj
=
JSON
.
parse
(
response
.
content
.
data
);
}
catch
(
ex
)
{
// do not set out.obj
log
(
"unable to parse JSON content"
);
}
}
else
out
.
obj
=
{}
}
}
if
(
response
.
status
>=
200
&&
response
.
status
<
300
)
cb
.
response
(
out
);
else
if
(
response
.
status
===
0
||
(
response
.
status
>=
400
&&
response
.
status
<
599
))
cb
.
error
(
out
);
else
return
cb
.
response
(
out
);
};
jQuery
.
support
.
cors
=
true
;
return
jQuery
.
ajax
(
obj
);
}
/*
* ShredHttpClient is a light-weight, node or browser HTTP client
*/
var
ShredHttpClient
=
function
(
options
)
{
this
.
options
=
(
options
||
{});
this
.
isInitialized
=
false
;
var
identity
,
toString
;
if
(
typeof
window
!==
'undefined'
)
{
this
.
Shred
=
require
(
"./shred"
);
this
.
content
=
require
(
"./shred/content"
);
}
else
this
.
Shred
=
require
(
"shred"
);
this
.
shred
=
new
this
.
Shred
(
options
);
}
ShredHttpClient
.
prototype
.
initShred
=
function
()
{
this
.
isInitialized
=
true
;
this
.
registerProcessors
(
this
.
shred
);
}
ShredHttpClient
.
prototype
.
registerProcessors
=
function
(
shred
)
{
var
identity
=
function
(
x
)
{
return
x
;
};
var
toString
=
function
(
x
)
{
return
x
.
toString
();
};
if
(
typeof
window
!==
'undefined'
)
{
this
.
content
.
registerProcessor
([
"application/json; charset=utf-8"
,
"application/json"
,
"json"
],
{
parser
:
identity
,
stringify
:
toString
});
}
else
{
this
.
Shred
.
registerProcessor
([
"application/json; charset=utf-8"
,
"application/json"
,
"json"
],
{
parser
:
identity
,
stringify
:
toString
});
}
}
ShredHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
if
(
!
this
.
isInitialized
)
this
.
initShred
();
var
cb
=
obj
.
on
,
res
;
var
transform
=
function
(
response
)
{
var
out
=
{
headers
:
response
.
_headers
,
url
:
response
.
request
.
url
,
method
:
response
.
request
.
method
,
status
:
response
.
status
,
data
:
response
.
content
.
data
};
var
contentType
=
(
response
.
_headers
[
"content-type"
]
||
response
.
_headers
[
"Content-Type"
]
||
null
)
if
(
contentType
!=
null
)
{
if
(
contentType
.
indexOf
(
"application/json"
)
==
0
||
contentType
.
indexOf
(
"+json"
)
>
0
)
{
if
(
response
.
content
.
data
&&
response
.
content
.
data
!==
""
)
try
{
out
.
obj
=
JSON
.
parse
(
response
.
content
.
data
);
}
catch
(
e
)
{
// unable to parse
}
else
out
.
obj
=
{}
}
}
return
out
;
};
res
=
{
error
:
function
(
response
)
{
if
(
obj
)
return
cb
.
error
(
transform
(
response
));
},
redirect
:
function
(
response
)
{
if
(
obj
)
return
cb
.
redirect
(
transform
(
response
));
},
307
:
function
(
response
)
{
if
(
obj
)
return
cb
.
redirect
(
transform
(
response
));
},
response
:
function
(
response
)
{
if
(
obj
)
return
cb
.
response
(
transform
(
response
));
}
};
if
(
obj
)
{
obj
.
on
=
res
;
}
return
this
.
shred
.
request
(
obj
);
};
\ No newline at end of file
code/moya-web/WebContent/swagger/lib/swagger-oauth.js
View file @
98c1144
...
@@ -7,10 +7,29 @@ var realm;
...
@@ -7,10 +7,29 @@ var realm;
function
handleLogin
()
{
function
handleLogin
()
{
var
scopes
=
[];
var
scopes
=
[];
if
(
window
.
swaggerUi
.
api
.
authSchemes
var
auths
=
window
.
swaggerUi
.
api
.
authSchemes
||
window
.
swaggerUi
.
api
.
securityDefinitions
;
&&
window
.
swaggerUi
.
api
.
authSchemes
.
oauth2
if
(
auths
)
{
&&
window
.
swaggerUi
.
api
.
authSchemes
.
oauth2
.
scopes
)
{
var
key
;
scopes
=
window
.
swaggerUi
.
api
.
authSchemes
.
oauth2
.
scopes
;
var
defs
=
auths
;
for
(
key
in
defs
)
{
var
auth
=
defs
[
key
];
if
(
auth
.
type
===
'oauth2'
&&
auth
.
scopes
)
{
var
scope
;
if
(
Array
.
isArray
(
auth
.
scopes
))
{
// 1.2 support
var
i
;
for
(
i
=
0
;
i
<
auth
.
scopes
.
length
;
i
++
)
{
scopes
.
push
(
auth
.
scopes
[
i
]);
}
}
else
{
// 2.0 support
for
(
scope
in
auth
.
scopes
)
{
scopes
.
push
({
scope
:
scope
,
description
:
auth
.
scopes
[
scope
]});
}
}
}
}
}
}
if
(
window
.
swaggerUi
.
api
if
(
window
.
swaggerUi
.
api
...
@@ -18,9 +37,6 @@ function handleLogin() {
...
@@ -18,9 +37,6 @@ function handleLogin() {
appName
=
window
.
swaggerUi
.
api
.
info
.
title
;
appName
=
window
.
swaggerUi
.
api
.
info
.
title
;
}
}
if
(
popupDialog
.
length
>
0
)
popupDialog
=
popupDialog
.
last
();
else
{
popupDialog
=
$
(
popupDialog
=
$
(
[
[
'<div class="api-popup-dialog">'
,
'<div class="api-popup-dialog">'
,
...
@@ -49,7 +65,6 @@ function handleLogin() {
...
@@ -49,7 +65,6 @@ function handleLogin() {
popup
.
append
(
str
);
popup
.
append
(
str
);
}
}
var
$win
=
$
(
window
),
var
$win
=
$
(
window
),
dw
=
$win
.
width
(),
dw
=
$win
.
width
(),
dh
=
$win
.
height
(),
dh
=
$win
.
height
(),
...
@@ -67,53 +82,58 @@ function handleLogin() {
...
@@ -67,53 +82,58 @@ function handleLogin() {
popupDialog
.
find
(
'button.api-popup-cancel'
).
click
(
function
()
{
popupDialog
.
find
(
'button.api-popup-cancel'
).
click
(
function
()
{
popupMask
.
hide
();
popupMask
.
hide
();
popupDialog
.
hide
();
popupDialog
.
hide
();
popupDialog
.
empty
();
popupDialog
=
[];
});
});
popupDialog
.
find
(
'button.api-popup-authbtn'
).
click
(
function
()
{
popupDialog
.
find
(
'button.api-popup-authbtn'
).
click
(
function
()
{
popupMask
.
hide
();
popupMask
.
hide
();
popupDialog
.
hide
();
popupDialog
.
hide
();
var
authSchemes
=
window
.
swaggerUi
.
api
.
authSchemes
;
var
authSchemes
=
window
.
swaggerUi
.
api
.
authSchemes
;
var
location
=
window
.
location
;
var
host
=
window
.
location
;
var
locationUrl
=
location
.
protocol
+
'//'
+
location
.
host
+
location
.
pathname
;
var
pathname
=
location
.
pathname
.
substring
(
0
,
location
.
pathname
.
lastIndexOf
(
"/"
))
;
var
redirectUrl
=
locationUrl
.
replace
(
"index.html"
,
""
).
concat
(
"/o2c.html"
).
replace
(
"//o2c.html"
,
"/o2c.html"
)
;
var
redirectUrl
=
host
.
protocol
+
'//'
+
host
.
host
+
pathname
+
'/o2c.html'
;
var
url
=
null
;
var
url
=
null
;
var
p
=
window
.
swaggerUi
.
api
.
authSchemes
;
for
(
var
key
in
authSchemes
)
{
for
(
var
key
in
p
)
{
if
(
authSchemes
.
hasOwnProperty
(
key
))
{
if
(
p
.
hasOwnProperty
(
key
))
{
if
(
authSchemes
[
key
].
type
===
'oauth2'
&&
authSchemes
[
key
].
flow
===
'implicit'
)
{
var
o
=
p
[
key
].
grantTypes
;
var
dets
=
authSchemes
[
key
];
url
=
dets
.
authorizationUrl
+
'?response_type=token'
;
window
.
swaggerUi
.
tokenName
=
dets
.
tokenUrl
||
'access_token'
;
}
else
if
(
authSchemes
[
key
].
grantTypes
)
{
// 1.2 support
var
o
=
authSchemes
[
key
].
grantTypes
;
for
(
var
t
in
o
)
{
for
(
var
t
in
o
)
{
if
(
o
.
hasOwnProperty
(
t
)
&&
t
===
'implicit'
)
{
if
(
o
.
hasOwnProperty
(
t
)
&&
t
===
'implicit'
)
{
var
dets
=
o
[
t
];
var
dets
=
o
[
t
];
url
=
dets
.
loginEndpoint
.
url
+
"?response_type=token"
;
var
ep
=
dets
.
loginEndpoint
.
url
;
url
=
dets
.
loginEndpoint
.
url
+
'?response_type=token'
;
window
.
swaggerUi
.
tokenName
=
dets
.
tokenName
;
window
.
swaggerUi
.
tokenName
=
dets
.
tokenName
;
}
}
}
}
}
}
}
}
var
scopes
=
[];
}
var
scopeForUrl
=
''
;
var
scopes
=
[]
var
o
=
$
(
'.api-popup-scopes'
).
find
(
'input:checked'
);
var
o
=
$
(
'.api-popup-scopes'
).
find
(
'input:checked'
);
for
(
var
k
=
0
;
k
<
o
.
length
;
k
++
)
{
for
(
k
=
0
;
k
<
o
.
length
;
k
++
)
{
scopes
.
push
(
$
(
o
[
k
]).
attr
(
"scope"
));
scopes
.
push
(
$
(
o
[
k
]).
attr
(
'scope'
));
if
(
k
>
0
){
scopeForUrl
+=
' '
;
}
scopeForUrl
+=
$
(
o
[
k
]).
attr
(
"scope"
);
}
}
window
.
enabledScopes
=
scopes
;
window
.
enabledScopes
=
scopes
;
url
+=
'&redirect_uri='
+
encodeURIComponent
(
redirectUrl
);
url
+=
'&redirect_uri='
+
encodeURIComponent
(
redirectUrl
);
url
+=
'&realm='
+
encodeURIComponent
(
realm
);
url
+=
'&realm='
+
encodeURIComponent
(
realm
);
url
+=
'&client_id='
+
encodeURIComponent
(
clientId
);
url
+=
'&client_id='
+
encodeURIComponent
(
clientId
);
url
+=
'&scope='
+
encodeURIComponent
(
scopeForUrl
);
url
+=
'&scope='
+
encodeURIComponent
(
scopes
);
window
.
open
(
url
);
window
.
open
(
url
);
});
});
}
popupMask
.
show
();
popupMask
.
show
();
popupDialog
.
show
();
popupDialog
.
show
();
return
;
return
;
...
@@ -137,14 +157,14 @@ function initOAuth(opts) {
...
@@ -137,14 +157,14 @@ function initOAuth(opts) {
var
o
=
(
opts
||
{});
var
o
=
(
opts
||
{});
var
errors
=
[];
var
errors
=
[];
appName
=
(
o
.
appName
||
errors
.
push
(
"missing appName"
));
appName
=
(
o
.
appName
||
errors
.
push
(
'missing appName'
));
popupMask
=
(
o
.
popupMask
||
$
(
'#api-common-mask'
));
popupMask
=
(
o
.
popupMask
||
$
(
'#api-common-mask'
));
popupDialog
=
(
o
.
popupDialog
||
$
(
'.api-popup-dialog'
));
popupDialog
=
(
o
.
popupDialog
||
$
(
'.api-popup-dialog'
));
clientId
=
(
o
.
clientId
||
errors
.
push
(
"missing client id"
));
clientId
=
(
o
.
clientId
||
errors
.
push
(
'missing client id'
));
realm
=
(
o
.
realm
||
errors
.
push
(
"missing realm"
));
realm
=
(
o
.
realm
||
errors
.
push
(
'missing realm'
));
if
(
errors
.
length
>
0
){
if
(
errors
.
length
>
0
){
log
(
"auth unable initialize oauth: "
+
errors
);
log
(
'auth unable initialize oauth: '
+
errors
);
return
;
return
;
}
}
...
@@ -210,8 +230,7 @@ function onOAuthComplete(token) {
...
@@ -210,8 +230,7 @@ function onOAuthComplete(token) {
}
}
}
}
});
});
window
.
authorizations
.
add
(
'oauth2'
,
new
ApiKeyAuthorization
(
'Authorization'
,
'Bearer '
+
b
,
'header'
));
window
.
authorizations
.
add
(
"key"
,
new
ApiKeyAuthorization
(
"Authorization"
,
"Bearer "
+
b
,
"header"
));
}
}
}
}
}
}
...
...
code/moya-web/WebContent/swagger/lib/swagger.js
View file @
98c1144
// swagger.js
// swagger.js
// version 2.0.
31
// version 2.0.
48
var
__bind
=
function
(
fn
,
me
){
(
function
()
{
return
function
(){
var
__bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
return
fn
.
apply
(
me
,
arguments
);
};
};
};
};
log
=
function
()
{
var
log
=
function
()
{
log
.
history
=
log
.
history
||
[];
log
.
history
=
log
.
history
||
[];
log
.
history
.
push
(
arguments
);
log
.
history
.
push
(
arguments
);
if
(
this
.
console
){
if
(
this
.
console
)
{
console
.
log
(
Array
.
prototype
.
slice
.
call
(
arguments
)
);
console
.
log
(
Array
.
prototype
.
slice
.
call
(
arguments
)[
0
]);
}
};
/**
* allows override of the default value based on the parameter being
* supplied
**/
var
applyParameterMacro
=
function
(
model
,
parameter
)
{
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
if
(
e
.
parameterMacro
)
return
e
.
parameterMacro
(
model
,
parameter
);
else
return
parameter
.
defaultValue
;
}
/**
* allows overriding the default value of an operation
**/
var
applyModelPropertyMacro
=
function
(
operation
,
property
)
{
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
if
(
e
.
modelPropertyMacro
)
return
e
.
modelPropertyMacro
(
operation
,
property
);
else
return
property
.
defaultValue
;
}
}
};
if
(
!
Array
.
prototype
.
indexOf
)
{
if
(
!
Array
.
prototype
.
indexOf
)
{
Array
.
prototype
.
indexOf
=
function
(
obj
,
start
)
{
Array
.
prototype
.
indexOf
=
function
(
obj
,
start
)
{
for
(
var
i
=
(
start
||
0
),
j
=
this
.
length
;
i
<
j
;
i
++
)
{
for
(
var
i
=
(
start
||
0
),
j
=
this
.
length
;
i
<
j
;
i
++
)
{
if
(
this
[
i
]
===
obj
)
{
return
i
;
}
if
(
this
[
i
]
===
obj
)
{
return
i
;
}
}
}
return
-
1
;
return
-
1
;
}
}
}
}
if
(
!
(
'filter'
in
Array
.
prototype
))
{
if
(
!
(
'filter'
in
Array
.
prototype
))
{
Array
.
prototype
.
filter
=
function
(
filter
,
that
/*opt*/
)
{
Array
.
prototype
.
filter
=
function
(
filter
,
that
/*opt*/
)
{
var
other
=
[],
v
;
var
other
=
[],
v
;
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
if
(
i
in
this
&&
filter
.
call
(
that
,
v
=
this
[
i
],
i
,
this
))
if
(
i
in
this
&&
filter
.
call
(
that
,
v
=
this
[
i
],
i
,
this
))
other
.
push
(
v
);
other
.
push
(
v
);
return
other
;
return
other
;
};
};
}
}
if
(
!
(
'map'
in
Array
.
prototype
))
{
if
(
!
(
'map'
in
Array
.
prototype
))
{
Array
.
prototype
.
map
=
function
(
mapper
,
that
/*opt*/
)
{
Array
.
prototype
.
map
=
function
(
mapper
,
that
/*opt*/
)
{
var
other
=
new
Array
(
this
.
length
);
var
other
=
new
Array
(
this
.
length
);
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
for
(
var
i
=
0
,
n
=
this
.
length
;
i
<
n
;
i
++
)
if
(
i
in
this
)
if
(
i
in
this
)
other
[
i
]
=
mapper
.
call
(
that
,
this
[
i
],
i
,
this
);
other
[
i
]
=
mapper
.
call
(
that
,
this
[
i
],
i
,
this
);
return
other
;
return
other
;
};
};
}
}
Object
.
keys
=
Object
.
keys
||
(
function
()
{
Object
.
keys
=
Object
.
keys
||
(
function
()
{
var
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
,
var
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
,
hasDontEnumBug
=
!
{
toString
:
null
}.
propertyIsEnumerable
(
"toString"
),
hasDontEnumBug
=
!
{
toString
:
null
}.
propertyIsEnumerable
(
'toString'
),
DontEnums
=
[
DontEnums
=
[
'toString'
,
'toString'
,
'toLocaleString'
,
'toLocaleString'
,
...
@@ -59,8 +83,8 @@ Object.keys = Object.keys || (function () {
...
@@ -59,8 +83,8 @@ Object.keys = Object.keys || (function () {
DontEnumsLength
=
DontEnums
.
length
;
DontEnumsLength
=
DontEnums
.
length
;
return
function
(
o
)
{
return
function
(
o
)
{
if
(
typeof
o
!=
"object"
&&
typeof
o
!=
"function"
||
o
===
null
)
if
(
typeof
o
!=
'object'
&&
typeof
o
!=
'function'
||
o
===
null
)
throw
new
TypeError
(
"Object.keys called on a non-object"
);
throw
new
TypeError
(
'Object.keys called on a non-object'
);
var
result
=
[];
var
result
=
[];
for
(
var
name
in
o
)
{
for
(
var
name
in
o
)
{
...
@@ -77,10 +101,10 @@ Object.keys = Object.keys || (function () {
...
@@ -77,10 +101,10 @@ Object.keys = Object.keys || (function () {
return
result
;
return
result
;
};
};
})();
})();
var
SwaggerApi
=
function
(
url
,
options
)
{
var
SwaggerApi
=
function
(
url
,
options
)
{
this
.
isBuilt
=
false
;
this
.
url
=
null
;
this
.
url
=
null
;
this
.
debug
=
false
;
this
.
debug
=
false
;
this
.
basePath
=
null
;
this
.
basePath
=
null
;
...
@@ -88,8 +112,10 @@ var SwaggerApi = function(url, options) {
...
@@ -88,8 +112,10 @@ var SwaggerApi = function(url, options) {
this
.
authorizationScheme
=
null
;
this
.
authorizationScheme
=
null
;
this
.
info
=
null
;
this
.
info
=
null
;
this
.
useJQuery
=
false
;
this
.
useJQuery
=
false
;
this
.
modelsArray
=
[];
this
.
isValid
;
options
=
(
options
||
{});
options
=
(
options
||
{});
if
(
url
)
if
(
url
)
if
(
url
.
url
)
if
(
url
.
url
)
options
=
url
;
options
=
url
;
...
@@ -101,30 +127,45 @@ var SwaggerApi = function(url, options) {
...
@@ -101,30 +127,45 @@ var SwaggerApi = function(url, options) {
if
(
options
.
url
!=
null
)
if
(
options
.
url
!=
null
)
this
.
url
=
options
.
url
;
this
.
url
=
options
.
url
;
this
.
swaggerRequstHeaders
=
options
.
swaggerRequstHeaders
||
'application/json,application/json;charset=utf-8,*/*'
;
this
.
defaultSuccessCallback
=
options
.
defaultSuccessCallback
||
null
;
this
.
defaultErrorCallback
=
options
.
defaultErrorCallback
||
null
;
if
(
options
.
success
!=
null
)
if
(
options
.
success
!=
null
)
this
.
success
=
options
.
success
;
this
.
success
=
options
.
success
;
if
(
typeof
options
.
useJQuery
===
'boolean'
)
if
(
typeof
options
.
useJQuery
===
'boolean'
)
this
.
useJQuery
=
options
.
useJQuery
;
this
.
useJQuery
=
options
.
useJQuery
;
this
.
failure
=
options
.
failure
!=
null
?
options
.
failure
:
function
()
{};
if
(
options
.
authorizations
)
{
this
.
progress
=
options
.
progress
!=
null
?
options
.
progress
:
function
()
{};
this
.
clientAuthorizations
=
options
.
authorizations
;
if
(
options
.
success
!=
null
)
}
else
{
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
this
.
clientAuthorizations
=
e
.
authorizations
;
}
this
.
failure
=
options
.
failure
!=
null
?
options
.
failure
:
function
()
{
};
this
.
progress
=
options
.
progress
!=
null
?
options
.
progress
:
function
()
{
};
if
(
options
.
success
!=
null
)
{
this
.
build
();
this
.
build
();
}
this
.
isBuilt
=
true
;
}
};
SwaggerApi
.
prototype
.
build
=
function
()
{
SwaggerApi
.
prototype
.
build
=
function
(
mock
)
{
if
(
this
.
isBuilt
)
return
this
;
var
_this
=
this
;
var
_this
=
this
;
this
.
progress
(
'fetching resource list: '
+
this
.
url
);
this
.
progress
(
'fetching resource list: '
+
this
.
url
);
var
obj
=
{
var
obj
=
{
useJQuery
:
this
.
useJQuery
,
useJQuery
:
this
.
useJQuery
,
url
:
this
.
url
,
url
:
this
.
url
,
method
:
"get"
,
method
:
'GET'
,
headers
:
{
headers
:
{
accept
:
"application/json"
accept
:
_this
.
swaggerRequstHeaders
},
},
on
:
{
on
:
{
error
:
function
(
response
)
{
error
:
function
(
response
)
{
if
(
_this
.
url
.
substring
(
0
,
4
)
!==
'http'
)
{
if
(
_this
.
url
.
substring
(
0
,
4
)
!==
'http'
)
{
return
_this
.
fail
(
'Please specify the protocol for '
+
_this
.
url
);
return
_this
.
fail
(
'Please specify the protocol for '
+
_this
.
url
);
}
else
if
(
response
.
status
===
0
)
{
}
else
if
(
response
.
status
===
0
)
{
...
@@ -135,10 +176,10 @@ SwaggerApi.prototype.build = function() {
...
@@ -135,10 +176,10 @@ SwaggerApi.prototype.build = function() {
return
_this
.
fail
(
response
.
status
+
' : '
+
response
.
statusText
+
' '
+
_this
.
url
);
return
_this
.
fail
(
response
.
status
+
' : '
+
response
.
statusText
+
' '
+
_this
.
url
);
}
}
},
},
response
:
function
(
resp
)
{
response
:
function
(
resp
)
{
var
responseObj
=
resp
.
obj
||
JSON
.
parse
(
resp
.
data
);
var
responseObj
=
resp
.
obj
||
JSON
.
parse
(
resp
.
data
);
_this
.
swaggerVersion
=
responseObj
.
swaggerVersion
;
_this
.
swaggerVersion
=
responseObj
.
swaggerVersion
;
if
(
_this
.
swaggerVersion
===
"1.2"
)
{
if
(
_this
.
swaggerVersion
===
'1.2'
)
{
return
_this
.
buildFromSpec
(
responseObj
);
return
_this
.
buildFromSpec
(
responseObj
);
}
else
{
}
else
{
return
_this
.
buildFrom1_1Spec
(
responseObj
);
return
_this
.
buildFrom1_1Spec
(
responseObj
);
...
@@ -148,16 +189,20 @@ SwaggerApi.prototype.build = function() {
...
@@ -148,16 +189,20 @@ SwaggerApi.prototype.build = function() {
};
};
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
e
.
authorizations
.
apply
(
obj
);
e
.
authorizations
.
apply
(
obj
);
if
(
mock
===
true
)
return
obj
;
new
SwaggerHttp
().
execute
(
obj
);
new
SwaggerHttp
().
execute
(
obj
);
return
this
;
return
this
;
};
};
SwaggerApi
.
prototype
.
buildFromSpec
=
function
(
response
)
{
SwaggerApi
.
prototype
.
buildFromSpec
=
function
(
response
)
{
if
(
response
.
apiVersion
!=
null
)
{
if
(
response
.
apiVersion
!=
null
)
{
this
.
apiVersion
=
response
.
apiVersion
;
this
.
apiVersion
=
response
.
apiVersion
;
}
}
this
.
apis
=
{};
this
.
apis
=
{};
this
.
apisArray
=
[];
this
.
apisArray
=
[];
this
.
consumes
=
response
.
consumes
;
this
.
produces
=
response
.
produces
;
this
.
produces
=
response
.
produces
;
this
.
authSchemes
=
response
.
authorizations
;
this
.
authSchemes
=
response
.
authorizations
;
if
(
response
.
info
!=
null
)
{
if
(
response
.
info
!=
null
)
{
...
@@ -175,36 +220,37 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
...
@@ -175,36 +220,37 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
}
}
}
}
}
}
if
(
response
.
basePath
)
{
if
(
response
.
basePath
)
this
.
basePath
=
response
.
basePath
;
this
.
basePath
=
response
.
basePath
;
}
else
if
(
this
.
url
.
indexOf
(
'?'
)
>
0
)
{
else
if
(
this
.
url
.
indexOf
(
'?'
)
>
0
)
this
.
basePath
=
this
.
url
.
substring
(
0
,
this
.
url
.
lastIndexOf
(
'?'
));
this
.
basePath
=
this
.
url
.
substring
(
0
,
this
.
url
.
lastIndexOf
(
'?'
));
}
else
{
else
this
.
basePath
=
this
.
url
;
this
.
basePath
=
this
.
url
;
}
if
(
isApi
)
{
if
(
isApi
)
{
var
newName
=
response
.
resourcePath
.
replace
(
/
\/
/g
,
''
);
var
newName
=
response
.
resourcePath
.
replace
(
/
\/
/g
,
''
);
this
.
resourcePath
=
response
.
resourcePath
;
this
.
resourcePath
=
response
.
resourcePath
;
res
=
new
SwaggerResource
(
response
,
this
);
var
res
=
new
SwaggerResource
(
response
,
this
);
this
.
apis
[
newName
]
=
res
;
this
.
apis
[
newName
]
=
res
;
this
.
apisArray
.
push
(
res
);
this
.
apisArray
.
push
(
res
);
}
else
{
}
else
{
var
k
;
var
k
;
for
(
k
=
0
;
k
<
response
.
apis
.
length
;
k
++
)
{
for
(
k
=
0
;
k
<
response
.
apis
.
length
;
k
++
)
{
var
resource
=
response
.
apis
[
k
];
var
resource
=
response
.
apis
[
k
];
res
=
new
SwaggerResource
(
resource
,
this
);
var
res
=
new
SwaggerResource
(
resource
,
this
);
this
.
apis
[
res
.
name
]
=
res
;
this
.
apis
[
res
.
name
]
=
res
;
this
.
apisArray
.
push
(
res
);
this
.
apisArray
.
push
(
res
);
}
}
}
}
this
.
isValid
=
true
;
if
(
this
.
success
)
{
if
(
this
.
success
)
{
this
.
success
();
this
.
success
();
}
}
return
this
;
return
this
;
};
};
SwaggerApi
.
prototype
.
buildFrom1_1Spec
=
function
(
response
)
{
SwaggerApi
.
prototype
.
buildFrom1_1Spec
=
function
(
response
)
{
log
(
"This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"
);
log
(
'This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info'
);
if
(
response
.
apiVersion
!=
null
)
if
(
response
.
apiVersion
!=
null
)
this
.
apiVersion
=
response
.
apiVersion
;
this
.
apiVersion
=
response
.
apiVersion
;
this
.
apis
=
{};
this
.
apis
=
{};
...
@@ -239,25 +285,26 @@ SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
...
@@ -239,25 +285,26 @@ SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
}
else
{
}
else
{
for
(
k
=
0
;
k
<
response
.
apis
.
length
;
k
++
)
{
for
(
k
=
0
;
k
<
response
.
apis
.
length
;
k
++
)
{
resource
=
response
.
apis
[
k
];
resource
=
response
.
apis
[
k
];
res
=
new
SwaggerResource
(
resource
,
this
);
var
res
=
new
SwaggerResource
(
resource
,
this
);
this
.
apis
[
res
.
name
]
=
res
;
this
.
apis
[
res
.
name
]
=
res
;
this
.
apisArray
.
push
(
res
);
this
.
apisArray
.
push
(
res
);
}
}
}
}
this
.
isValid
=
true
;
if
(
this
.
success
)
{
if
(
this
.
success
)
{
this
.
success
();
this
.
success
();
}
}
return
this
;
return
this
;
};
};
SwaggerApi
.
prototype
.
selfReflect
=
function
()
{
SwaggerApi
.
prototype
.
selfReflect
=
function
()
{
var
resource
,
resource_name
,
_
ref
;
var
resource
,
resource_name
,
ref
;
if
(
this
.
apis
==
null
)
{
if
(
this
.
apis
==
null
)
{
return
false
;
return
false
;
}
}
_
ref
=
this
.
apis
;
ref
=
this
.
apis
;
for
(
resource_name
in
_
ref
)
{
for
(
resource_name
in
ref
)
{
resource
=
_
ref
[
resource_name
];
resource
=
ref
[
resource_name
];
if
(
resource
.
ready
==
null
)
{
if
(
resource
.
ready
==
null
)
{
return
false
;
return
false
;
}
}
...
@@ -267,16 +314,15 @@ SwaggerApi.prototype.selfReflect = function() {
...
@@ -267,16 +314,15 @@ SwaggerApi.prototype.selfReflect = function() {
if
(
this
.
success
!=
null
)
{
if
(
this
.
success
!=
null
)
{
return
this
.
success
();
return
this
.
success
();
}
}
};
};
SwaggerApi
.
prototype
.
fail
=
function
(
message
)
{
SwaggerApi
.
prototype
.
fail
=
function
(
message
)
{
this
.
failure
(
message
);
this
.
failure
(
message
);
throw
message
;
throw
message
;
};
};
SwaggerApi
.
prototype
.
setConsolidatedModels
=
function
()
{
SwaggerApi
.
prototype
.
setConsolidatedModels
=
function
()
{
var
model
,
modelName
,
resource
,
resource_name
,
_i
,
_len
,
_ref
,
_ref1
,
_results
;
var
model
,
modelName
,
resource
,
resource_name
,
_i
,
_len
,
_ref
,
_ref1
,
_results
;
this
.
modelsArray
=
[];
this
.
models
=
{};
this
.
models
=
{};
_ref
=
this
.
apis
;
_ref
=
this
.
apis
;
for
(
resource_name
in
_ref
)
{
for
(
resource_name
in
_ref
)
{
...
@@ -295,9 +341,9 @@ SwaggerApi.prototype.setConsolidatedModels = function() {
...
@@ -295,9 +341,9 @@ SwaggerApi.prototype.setConsolidatedModels = function() {
_results
.
push
(
model
.
setReferencedModels
(
this
.
models
));
_results
.
push
(
model
.
setReferencedModels
(
this
.
models
));
}
}
return
_results
;
return
_results
;
};
};
SwaggerApi
.
prototype
.
help
=
function
()
{
SwaggerApi
.
prototype
.
help
=
function
()
{
var
operation
,
operation_name
,
parameter
,
resource
,
resource_name
,
_i
,
_len
,
_ref
,
_ref1
,
_ref2
;
var
operation
,
operation_name
,
parameter
,
resource
,
resource_name
,
_i
,
_len
,
_ref
,
_ref1
,
_ref2
;
_ref
=
this
.
apis
;
_ref
=
this
.
apis
;
for
(
resource_name
in
_ref
)
{
for
(
resource_name
in
_ref
)
{
...
@@ -306,27 +352,26 @@ SwaggerApi.prototype.help = function() {
...
@@ -306,27 +352,26 @@ SwaggerApi.prototype.help = function() {
_ref1
=
resource
.
operations
;
_ref1
=
resource
.
operations
;
for
(
operation_name
in
_ref1
)
{
for
(
operation_name
in
_ref1
)
{
operation
=
_ref1
[
operation_name
];
operation
=
_ref1
[
operation_name
];
log
(
" "
+
operation
.
nickname
);
log
(
' '
+
operation
.
nickname
);
_ref2
=
operation
.
parameters
;
_ref2
=
operation
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref2
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref2
.
length
;
_i
<
_len
;
_i
++
)
{
parameter
=
_ref2
[
_i
];
parameter
=
_ref2
[
_i
];
log
(
" "
+
parameter
.
name
+
(
parameter
.
required
?
' (required)'
:
''
)
+
" - "
+
parameter
.
description
);
log
(
' '
+
parameter
.
name
+
(
parameter
.
required
?
' (required)'
:
''
)
+
' - '
+
parameter
.
description
);
}
}
}
}
}
}
return
this
;
return
this
;
};
};
var
SwaggerResource
=
function
(
resourceObj
,
api
)
{
var
SwaggerResource
=
function
(
resourceObj
,
api
)
{
var
_this
=
this
;
var
_this
=
this
;
this
.
api
=
api
;
this
.
api
=
api
;
this
.
api
=
this
.
api
;
this
.
swaggerRequstHeaders
=
api
.
swaggerRequstHeaders
;
produces
=
[];
consumes
=
[];
this
.
path
=
this
.
api
.
resourcePath
!=
null
?
this
.
api
.
resourcePath
:
resourceObj
.
path
;
this
.
path
=
this
.
api
.
resourcePath
!=
null
?
this
.
api
.
resourcePath
:
resourceObj
.
path
;
this
.
description
=
resourceObj
.
description
;
this
.
description
=
resourceObj
.
description
;
this
.
authorizations
=
(
resourceObj
.
authorizations
||
{});
var
parts
=
this
.
path
.
split
(
"/"
);
var
parts
=
this
.
path
.
split
(
'/'
);
this
.
name
=
parts
[
parts
.
length
-
1
].
replace
(
'.{format}'
,
''
);
this
.
name
=
parts
[
parts
.
length
-
1
].
replace
(
'.{format}'
,
''
);
this
.
basePath
=
this
.
api
.
basePath
;
this
.
basePath
=
this
.
api
.
basePath
;
this
.
operations
=
{};
this
.
operations
=
{};
...
@@ -340,7 +385,7 @@ var SwaggerResource = function(resourceObj, api) {
...
@@ -340,7 +385,7 @@ var SwaggerResource = function(resourceObj, api) {
this
.
addApiDeclaration
(
resourceObj
);
this
.
addApiDeclaration
(
resourceObj
);
}
else
{
}
else
{
if
(
this
.
path
==
null
)
{
if
(
this
.
path
==
null
)
{
this
.
api
.
fail
(
"SwaggerResources must have a path."
);
this
.
api
.
fail
(
'SwaggerResources must have a path.'
);
}
}
if
(
this
.
path
.
substring
(
0
,
4
)
===
'http'
)
{
if
(
this
.
path
.
substring
(
0
,
4
)
===
'http'
)
{
this
.
url
=
this
.
path
.
replace
(
'{format}'
,
'json'
);
this
.
url
=
this
.
path
.
replace
(
'{format}'
,
'json'
);
...
@@ -348,21 +393,21 @@ var SwaggerResource = function(resourceObj, api) {
...
@@ -348,21 +393,21 @@ var SwaggerResource = function(resourceObj, api) {
this
.
url
=
this
.
api
.
basePath
+
this
.
path
.
replace
(
'{format}'
,
'json'
);
this
.
url
=
this
.
api
.
basePath
+
this
.
path
.
replace
(
'{format}'
,
'json'
);
}
}
this
.
api
.
progress
(
'fetching resource '
+
this
.
name
+
': '
+
this
.
url
);
this
.
api
.
progress
(
'fetching resource '
+
this
.
name
+
': '
+
this
.
url
);
obj
=
{
var
obj
=
{
url
:
this
.
url
,
url
:
this
.
url
,
method
:
"get"
,
method
:
'GET'
,
useJQuery
:
this
.
useJQuery
,
useJQuery
:
this
.
useJQuery
,
headers
:
{
headers
:
{
accept
:
"application/json"
accept
:
this
.
swaggerRequstHeaders
},
},
on
:
{
on
:
{
response
:
function
(
resp
)
{
response
:
function
(
resp
)
{
var
responseObj
=
resp
.
obj
||
JSON
.
parse
(
resp
.
data
);
var
responseObj
=
resp
.
obj
||
JSON
.
parse
(
resp
.
data
);
return
_this
.
addApiDeclaration
(
responseObj
);
return
_this
.
addApiDeclaration
(
responseObj
);
},
},
error
:
function
(
response
)
{
error
:
function
(
response
)
{
return
_this
.
api
.
fail
(
"Unable to read api '"
+
return
_this
.
api
.
fail
(
'Unable to read api \''
+
_this
.
name
+
"' from path "
+
_this
.
url
+
" (server returned "
+
response
.
statusText
+
")"
);
_this
.
name
+
'\' from path '
+
_this
.
url
+
' (server returned '
+
response
.
statusText
+
')'
);
}
}
}
}
};
};
...
@@ -370,38 +415,40 @@ var SwaggerResource = function(resourceObj, api) {
...
@@ -370,38 +415,40 @@ var SwaggerResource = function(resourceObj, api) {
e
.
authorizations
.
apply
(
obj
);
e
.
authorizations
.
apply
(
obj
);
new
SwaggerHttp
().
execute
(
obj
);
new
SwaggerHttp
().
execute
(
obj
);
}
}
}
}
SwaggerResource
.
prototype
.
getAbsoluteBasePath
=
function
(
relativeBasePath
)
{
SwaggerResource
.
prototype
.
getAbsoluteBasePath
=
function
(
relativeBasePath
)
{
var
pos
,
url
;
var
pos
,
url
;
url
=
this
.
api
.
basePath
;
url
=
this
.
api
.
basePath
;
pos
=
url
.
lastIndexOf
(
relativeBasePath
);
pos
=
url
.
lastIndexOf
(
relativeBasePath
);
var
parts
=
url
.
split
(
"/"
);
var
parts
=
url
.
split
(
'/'
);
var
rootUrl
=
parts
[
0
]
+
"//"
+
parts
[
2
];
var
rootUrl
=
parts
[
0
]
+
'//'
+
parts
[
2
];
//if the relative path is '/' return the root url
if
(
relativeBasePath
===
'/'
){
if
(
relativeBasePath
.
indexOf
(
'http'
)
===
0
)
return
rootUrl
return
relativeBasePath
;
}
if
(
relativeBasePath
===
'/'
)
//if the relative path is not in the base path
return
rootUrl
;
else
if
(
pos
===
-
1
)
{
if
(
relativeBasePath
.
substring
(
0
,
1
)
==
'/'
)
{
if
(
relativeBasePath
.
indexOf
(
"/"
)
===
0
)
{
// use root + relative
return
url
+
relativeBasePath
;
return
rootUrl
+
relativeBasePath
;
}
else
{
return
url
+
"/"
+
relativeBasePath
;
}
}
//If the relative path is in the base path
else
{
}
else
{
var
pos
=
this
.
basePath
.
lastIndexOf
(
'/'
);
return
url
.
substring
(
0
,
pos
)
+
relativeBasePath
;
var
base
=
this
.
basePath
.
substring
(
0
,
pos
);
if
(
base
.
substring
(
base
.
length
-
1
)
==
'/'
)
return
base
+
relativeBasePath
;
else
return
base
+
'/'
+
relativeBasePath
;
}
}
};
};
SwaggerResource
.
prototype
.
addApiDeclaration
=
function
(
response
)
{
SwaggerResource
.
prototype
.
addApiDeclaration
=
function
(
response
)
{
if
(
response
.
produces
!=
null
)
if
(
response
.
produces
!=
null
)
this
.
produces
=
response
.
produces
;
this
.
produces
=
response
.
produces
;
if
(
response
.
consumes
!=
null
)
if
(
response
.
consumes
!=
null
)
this
.
consumes
=
response
.
consumes
;
this
.
consumes
=
response
.
consumes
;
if
((
response
.
basePath
!=
null
)
&&
response
.
basePath
.
replace
(
/
\s
/g
,
''
).
length
>
0
)
if
((
response
.
basePath
!=
null
)
&&
response
.
basePath
.
replace
(
/
\s
/g
,
''
).
length
>
0
)
this
.
basePath
=
response
.
basePath
.
indexOf
(
"http"
)
===
-
1
?
this
.
getAbsoluteBasePath
(
response
.
basePath
)
:
response
.
basePath
;
this
.
basePath
=
response
.
basePath
.
indexOf
(
'http'
)
===
-
1
?
this
.
getAbsoluteBasePath
(
response
.
basePath
)
:
response
.
basePath
;
this
.
addModels
(
response
.
models
);
this
.
addModels
(
response
.
models
);
if
(
response
.
apis
)
{
if
(
response
.
apis
)
{
...
@@ -413,9 +460,9 @@ SwaggerResource.prototype.addApiDeclaration = function(response) {
...
@@ -413,9 +460,9 @@ SwaggerResource.prototype.addApiDeclaration = function(response) {
this
.
api
[
this
.
name
]
=
this
;
this
.
api
[
this
.
name
]
=
this
;
this
.
ready
=
true
;
this
.
ready
=
true
;
return
this
.
api
.
selfReflect
();
return
this
.
api
.
selfReflect
();
};
};
SwaggerResource
.
prototype
.
addModels
=
function
(
models
)
{
SwaggerResource
.
prototype
.
addModels
=
function
(
models
)
{
if
(
models
!=
null
)
{
if
(
models
!=
null
)
{
var
modelName
;
var
modelName
;
for
(
modelName
in
models
)
{
for
(
modelName
in
models
)
{
...
@@ -428,18 +475,18 @@ SwaggerResource.prototype.addModels = function(models) {
...
@@ -428,18 +475,18 @@ SwaggerResource.prototype.addModels = function(models) {
}
}
var
output
=
[];
var
output
=
[];
for
(
var
i
=
0
;
i
<
this
.
modelsArray
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
modelsArray
.
length
;
i
++
)
{
model
=
this
.
modelsArray
[
i
];
var
model
=
this
.
modelsArray
[
i
];
output
.
push
(
model
.
setReferencedModels
(
this
.
models
));
output
.
push
(
model
.
setReferencedModels
(
this
.
models
));
}
}
return
output
;
return
output
;
}
}
};
};
SwaggerResource
.
prototype
.
addOperations
=
function
(
resource_path
,
ops
,
consumes
,
produces
)
{
SwaggerResource
.
prototype
.
addOperations
=
function
(
resource_path
,
ops
,
consumes
,
produces
)
{
if
(
ops
)
{
if
(
ops
)
{
output
=
[];
var
output
=
[];
for
(
var
i
=
0
;
i
<
ops
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
ops
.
length
;
i
++
)
{
o
=
ops
[
i
];
var
o
=
ops
[
i
];
consumes
=
this
.
consumes
;
consumes
=
this
.
consumes
;
produces
=
this
.
produces
;
produces
=
this
.
produces
;
if
(
o
.
consumes
!=
null
)
if
(
o
.
consumes
!=
null
)
...
@@ -451,16 +498,16 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
...
@@ -451,16 +498,16 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
produces
=
o
.
produces
;
produces
=
o
.
produces
;
else
else
produces
=
this
.
produces
;
produces
=
this
.
produces
;
type
=
(
o
.
type
||
o
.
responseClass
);
var
type
=
(
o
.
type
||
o
.
responseClass
);
if
(
type
===
"array"
)
{
if
(
type
===
'array'
)
{
ref
=
null
;
ref
=
null
;
if
(
o
.
items
)
if
(
o
.
items
)
ref
=
o
.
items
[
"type"
]
||
o
.
items
[
"$ref"
];
ref
=
o
.
items
[
'type'
]
||
o
.
items
[
'$ref'
];
type
=
"array["
+
ref
+
"]"
;
type
=
'array['
+
ref
+
']'
;
}
}
responseMessages
=
o
.
responseMessages
;
var
responseMessages
=
o
.
responseMessages
;
method
=
o
.
method
;
var
method
=
o
.
method
;
if
(
o
.
httpMethod
)
{
if
(
o
.
httpMethod
)
{
method
=
o
.
httpMethod
;
method
=
o
.
httpMethod
;
}
}
...
@@ -476,40 +523,24 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
...
@@ -476,40 +523,24 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
}
}
}
}
o
.
nickname
=
this
.
sanitize
(
o
.
nickname
);
o
.
nickname
=
this
.
sanitize
(
o
.
nickname
);
op
=
new
SwaggerOperation
(
o
.
nickname
,
resource_path
,
method
,
o
.
parameters
,
o
.
summary
,
o
.
notes
,
type
,
responseMessages
,
this
,
consumes
,
produces
,
o
.
authorizations
);
var
op
=
new
SwaggerOperation
(
o
.
nickname
,
resource_path
,
method
,
o
.
parameters
,
o
.
summary
,
o
.
notes
,
type
,
responseMessages
,
this
,
consumes
,
produces
,
o
.
authorizations
,
o
.
deprecated
);
this
.
operations
[
op
.
nickname
]
=
op
;
this
.
operations
[
op
.
nickname
]
=
op
;
output
.
push
(
this
.
operationsArray
.
push
(
op
));
output
.
push
(
this
.
operationsArray
.
push
(
op
));
}
}
return
output
;
return
output
;
}
}
};
};
SwaggerResource
.
prototype
.
sanitize
=
function
(
nickname
)
{
SwaggerResource
.
prototype
.
sanitize
=
function
(
nickname
)
{
var
op
;
var
op
;
op
=
nickname
.
replace
(
/
[\s
!@#$%^&*()_+=
\[
{
\]
};:<>|.
\/
?,
\\
'""-
]
/g
,
'_'
);
op
=
nickname
.
replace
(
/
[\s
!@#$%^&*()_+=
\[
{
\]
};:<>|.
\/
?,
\\
'""-
]
/g
,
'_'
);
op
=
op
.
replace
(
/
((
_
){2,})
/g
,
'_'
);
op
=
op
.
replace
(
/
((
_
){2,})
/g
,
'_'
);
op
=
op
.
replace
(
/^
(
_
)
*/g
,
''
);
op
=
op
.
replace
(
/^
(
_
)
*/g
,
''
);
op
=
op
.
replace
(
/
([
_
])
*$/g
,
''
);
op
=
op
.
replace
(
/
([
_
])
*$/g
,
''
);
return
op
;
return
op
;
};
};
SwaggerResource
.
prototype
.
help
=
function
()
{
var
op
=
this
.
operations
;
var
output
=
[];
var
operation_name
;
for
(
operation_name
in
op
)
{
operation
=
op
[
operation_name
];
var
msg
=
" "
+
operation
.
nickname
;
for
(
var
i
=
0
;
i
<
operation
.
parameters
;
i
++
)
{
parameter
=
operation
.
parameters
[
i
];
msg
.
concat
(
" "
+
parameter
.
name
+
(
parameter
.
required
?
' (required)'
:
''
)
+
" - "
+
parameter
.
description
);
}
output
.
push
(
msg
);
}
return
output
;
};
var
SwaggerModel
=
function
(
modelName
,
obj
)
{
var
SwaggerModel
=
function
(
modelName
,
obj
)
{
this
.
name
=
obj
.
id
!=
null
?
obj
.
id
:
modelName
;
this
.
name
=
obj
.
id
!=
null
?
obj
.
id
:
modelName
;
this
.
properties
=
[];
this
.
properties
=
[];
var
propertyName
;
var
propertyName
;
...
@@ -522,12 +553,12 @@ var SwaggerModel = function(modelName, obj) {
...
@@ -522,12 +553,12 @@ var SwaggerModel = function(modelName, obj) {
}
}
}
}
}
}
prop
=
new
SwaggerModelProperty
(
propertyName
,
obj
.
properties
[
propertyName
]
);
var
prop
=
new
SwaggerModelProperty
(
propertyName
,
obj
.
properties
[
propertyName
],
this
);
this
.
properties
.
push
(
prop
);
this
.
properties
.
push
(
prop
);
}
}
}
}
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
var
results
=
[];
var
results
=
[];
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
var
property
=
this
.
properties
[
i
];
var
property
=
this
.
properties
[
i
];
...
@@ -540,17 +571,16 @@ SwaggerModel.prototype.setReferencedModels = function(allModels) {
...
@@ -540,17 +571,16 @@ SwaggerModel.prototype.setReferencedModels = function(allModels) {
results
.
push
(
void
0
);
results
.
push
(
void
0
);
}
}
return
results
;
return
results
;
};
};
SwaggerModel
.
prototype
.
getMockSignature
=
function
(
modelsToIgnore
)
{
SwaggerModel
.
prototype
.
getMockSignature
=
function
(
modelsToIgnore
)
{
var
propertiesStr
=
[];
var
propertiesStr
=
[];
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
prop
=
this
.
properties
[
i
];
var
prop
=
this
.
properties
[
i
];
propertiesStr
.
push
(
prop
.
toString
());
propertiesStr
.
push
(
prop
.
toString
());
}
}
var
strong
=
'<span class="strong">'
;
var
strong
=
'<span class="strong">'
;
var
stronger
=
'<span class="stronger">'
;
var
strongClose
=
'</span>'
;
var
strongClose
=
'</span>'
;
var
classOpen
=
strong
+
this
.
name
+
' {'
+
strongClose
;
var
classOpen
=
strong
+
this
.
name
+
' {'
+
strongClose
;
var
classClose
=
strong
+
'}'
+
strongClose
;
var
classClose
=
strong
+
'}'
+
strongClose
;
...
@@ -560,37 +590,38 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
...
@@ -560,37 +590,38 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
modelsToIgnore
.
push
(
this
.
name
);
modelsToIgnore
.
push
(
this
.
name
);
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
prop
=
this
.
properties
[
i
];
var
prop
=
this
.
properties
[
i
];
if
((
prop
.
refModel
!=
null
)
&&
modelsToIgnore
.
indexOf
(
prop
.
refModel
.
name
)
===
-
1
)
{
if
((
prop
.
refModel
!=
null
)
&&
modelsToIgnore
.
indexOf
(
prop
.
refModel
.
name
)
===
-
1
)
{
returnVal
=
returnVal
+
(
'<br>'
+
prop
.
refModel
.
getMockSignature
(
modelsToIgnore
));
returnVal
=
returnVal
+
(
'<br>'
+
prop
.
refModel
.
getMockSignature
(
modelsToIgnore
));
}
}
}
}
return
returnVal
;
return
returnVal
;
};
};
SwaggerModel
.
prototype
.
createJSONSample
=
function
(
modelsToIgnore
)
{
SwaggerModel
.
prototype
.
createJSONSample
=
function
(
modelsToIgnore
)
{
if
(
sampleModels
[
this
.
name
])
{
if
(
sampleModels
[
this
.
name
])
{
return
sampleModels
[
this
.
name
];
return
sampleModels
[
this
.
name
];
}
}
else
{
else
{
var
result
=
{};
var
result
=
{};
var
modelsToIgnore
=
(
modelsToIgnore
||
[])
var
modelsToIgnore
=
(
modelsToIgnore
||
[])
modelsToIgnore
.
push
(
this
.
name
);
modelsToIgnore
.
push
(
this
.
name
);
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
properties
.
length
;
i
++
)
{
prop
=
this
.
properties
[
i
];
var
prop
=
this
.
properties
[
i
];
result
[
prop
.
name
]
=
prop
.
getSampleValue
(
modelsToIgnore
);
result
[
prop
.
name
]
=
prop
.
getSampleValue
(
modelsToIgnore
);
}
}
modelsToIgnore
.
pop
(
this
.
name
);
modelsToIgnore
.
pop
(
this
.
name
);
return
result
;
return
result
;
}
}
};
};
var
SwaggerModelProperty
=
function
(
name
,
obj
)
{
var
SwaggerModelProperty
=
function
(
name
,
obj
,
model
)
{
this
.
name
=
name
;
this
.
name
=
name
;
this
.
dataType
=
obj
.
type
||
obj
.
dataType
||
obj
[
"$ref"
];
this
.
dataType
=
obj
.
type
||
obj
.
dataType
||
obj
[
'$ref'
];
this
.
isCollection
=
this
.
dataType
&&
(
this
.
dataType
.
toLowerCase
()
===
'array'
||
this
.
dataType
.
toLowerCase
()
===
'list'
||
this
.
dataType
.
toLowerCase
()
===
'set'
);
this
.
isCollection
=
this
.
dataType
&&
(
this
.
dataType
.
toLowerCase
()
===
'array'
||
this
.
dataType
.
toLowerCase
()
===
'list'
||
this
.
dataType
.
toLowerCase
()
===
'set'
);
this
.
descr
=
obj
.
description
;
this
.
descr
=
obj
.
description
;
this
.
required
=
obj
.
required
;
this
.
required
=
obj
.
required
;
this
.
defaultValue
=
applyModelPropertyMacro
(
obj
,
model
);
if
(
obj
.
items
!=
null
)
{
if
(
obj
.
items
!=
null
)
{
if
(
obj
.
items
.
type
!=
null
)
{
if
(
obj
.
items
.
type
!=
null
)
{
this
.
refDataType
=
obj
.
items
.
type
;
this
.
refDataType
=
obj
.
items
.
type
;
...
@@ -604,21 +635,21 @@ var SwaggerModelProperty = function(name, obj) {
...
@@ -604,21 +635,21 @@ var SwaggerModelProperty = function(name, obj) {
this
.
valueType
=
obj
.
allowableValues
.
valueType
;
this
.
valueType
=
obj
.
allowableValues
.
valueType
;
this
.
values
=
obj
.
allowableValues
.
values
;
this
.
values
=
obj
.
allowableValues
.
values
;
if
(
this
.
values
!=
null
)
{
if
(
this
.
values
!=
null
)
{
this
.
valuesString
=
"'"
+
this
.
values
.
join
(
"' or '"
)
+
"'"
;
this
.
valuesString
=
'\''
+
this
.
values
.
join
(
'\' or \''
)
+
'\''
;
}
}
}
}
if
(
obj
[
"enum"
]
!=
null
)
{
if
(
obj
[
'enum'
]
!=
null
)
{
this
.
valueType
=
"string"
;
this
.
valueType
=
'string'
;
this
.
values
=
obj
[
"enum"
];
this
.
values
=
obj
[
'enum'
];
if
(
this
.
values
!=
null
)
{
if
(
this
.
values
!=
null
)
{
this
.
valueString
=
"'"
+
this
.
values
.
join
(
"' or '"
)
+
"'"
;
this
.
valueString
=
'\''
+
this
.
values
.
join
(
'\' or \''
)
+
'\''
;
}
}
}
}
}
}
SwaggerModelProperty
.
prototype
.
getSampleValue
=
function
(
modelsToIgnore
)
{
SwaggerModelProperty
.
prototype
.
getSampleValue
=
function
(
modelsToIgnore
)
{
var
result
;
var
result
;
if
((
this
.
refModel
!=
null
)
&&
(
modelsToIgnore
.
indexOf
(
prop
.
refModel
.
name
)
===
-
1
))
{
if
((
this
.
refModel
!=
null
)
&&
(
modelsToIgnore
.
indexOf
(
this
.
refModel
.
name
)
===
-
1
))
{
result
=
this
.
refModel
.
createJSONSample
(
modelsToIgnore
);
result
=
this
.
refModel
.
createJSONSample
(
modelsToIgnore
);
}
else
{
}
else
{
if
(
this
.
isCollection
)
{
if
(
this
.
isCollection
)
{
...
@@ -632,25 +663,27 @@ SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
...
@@ -632,25 +663,27 @@ SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
}
else
{
}
else
{
return
result
;
return
result
;
}
}
};
};
SwaggerModelProperty
.
prototype
.
toSampleValue
=
function
(
value
)
{
SwaggerModelProperty
.
prototype
.
toSampleValue
=
function
(
value
)
{
var
result
;
var
result
;
if
(
value
===
"integer"
)
{
if
((
typeof
this
.
defaultValue
!==
'undefined'
)
&&
this
.
defaultValue
!==
null
)
{
result
=
this
.
defaultValue
;
}
else
if
(
value
===
'integer'
)
{
result
=
0
;
result
=
0
;
}
else
if
(
value
===
"boolean"
)
{
}
else
if
(
value
===
'boolean'
)
{
result
=
false
;
result
=
false
;
}
else
if
(
value
===
"double"
||
value
===
"number"
)
{
}
else
if
(
value
===
'double'
||
value
===
'number'
)
{
result
=
0.0
;
result
=
0.0
;
}
else
if
(
value
===
"string"
)
{
}
else
if
(
value
===
'string'
)
{
result
=
""
;
result
=
''
;
}
else
{
}
else
{
result
=
value
;
result
=
value
;
}
}
return
result
;
return
result
;
};
};
SwaggerModelProperty
.
prototype
.
toString
=
function
()
{
SwaggerModelProperty
.
prototype
.
toString
=
function
()
{
var
req
=
this
.
required
?
'propReq'
:
'propOpt'
;
var
req
=
this
.
required
?
'propReq'
:
'propOpt'
;
var
str
=
'<span class="propName '
+
req
+
'">'
+
this
.
name
+
'</span> (<span class="propType">'
+
this
.
dataTypeWithRef
+
'</span>'
;
var
str
=
'<span class="propName '
+
req
+
'">'
+
this
.
name
+
'</span> (<span class="propType">'
+
this
.
dataTypeWithRef
+
'</span>'
;
if
(
!
this
.
required
)
{
if
(
!
this
.
required
)
{
...
@@ -658,106 +691,109 @@ SwaggerModelProperty.prototype.toString = function() {
...
@@ -658,106 +691,109 @@ SwaggerModelProperty.prototype.toString = function() {
}
}
str
+=
')'
;
str
+=
')'
;
if
(
this
.
values
!=
null
)
{
if
(
this
.
values
!=
null
)
{
str
+=
" = <span class='propVals'>['"
+
this
.
values
.
join
(
"' or '"
)
+
"']</span>"
;
str
+=
' = <span class="propVals">["'
+
this
.
values
.
join
(
'\' or \''
)
+
'\']</span>'
;
}
}
if
(
this
.
descr
!=
null
)
{
if
(
this
.
descr
!=
null
)
{
str
+=
': <span class="propDesc">'
+
this
.
descr
+
'</span>'
;
str
+=
': <span class="propDesc">'
+
this
.
descr
+
'</span>'
;
}
}
return
str
;
return
str
;
};
};
var
SwaggerOperation
=
function
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
type
,
responseMessages
,
resource
,
consumes
,
produces
,
authorizations
)
{
var
SwaggerOperation
=
function
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
type
,
responseMessages
,
resource
,
consumes
,
produces
,
authorizations
,
deprecated
)
{
var
_this
=
this
;
var
_this
=
this
;
var
errors
=
[];
var
errors
=
[];
this
.
nickname
=
(
nickname
||
errors
.
push
(
"SwaggerOperations must have a nickname."
));
this
.
nickname
=
(
nickname
||
errors
.
push
(
'SwaggerOperations must have a nickname.'
));
this
.
path
=
(
path
||
errors
.
push
(
"SwaggerOperation "
+
nickname
+
" is missing path."
));
this
.
path
=
(
path
||
errors
.
push
(
'SwaggerOperation '
+
nickname
+
' is missing path.'
));
this
.
method
=
(
method
||
errors
.
push
(
"SwaggerOperation "
+
nickname
+
" is missing method."
));
this
.
method
=
(
method
||
errors
.
push
(
'SwaggerOperation '
+
nickname
+
' is missing method.'
));
this
.
parameters
=
parameters
!=
null
?
parameters
:
[];
this
.
parameters
=
parameters
!=
null
?
parameters
:
[];
this
.
summary
=
summary
;
this
.
summary
=
summary
;
this
.
notes
=
notes
;
this
.
notes
=
notes
;
this
.
type
=
type
;
this
.
type
=
type
;
this
.
responseMessages
=
(
responseMessages
||
[]);
this
.
responseMessages
=
(
responseMessages
||
[]);
this
.
resource
=
(
resource
||
errors
.
push
(
"Resource is required"
));
this
.
resource
=
(
resource
||
errors
.
push
(
'Resource is required'
));
this
.
consumes
=
consumes
;
this
.
consumes
=
consumes
;
this
.
produces
=
produces
;
this
.
produces
=
produces
;
this
.
authorizations
=
authorizations
;
this
.
authorizations
=
typeof
authorizations
!==
'undefined'
?
authorizations
:
resource
.
authorizations
;
this
[
"do"
]
=
__bind
(
this
[
"do"
],
this
);
this
.
deprecated
=
deprecated
;
this
[
'do'
]
=
__bind
(
this
[
'do'
],
this
);
if
(
errors
.
length
>
0
)
if
(
errors
.
length
>
0
)
{
console
.
error
(
'SwaggerOperation errors'
,
errors
,
arguments
);
this
.
resource
.
api
.
fail
(
errors
);
this
.
resource
.
api
.
fail
(
errors
);
}
this
.
path
=
this
.
path
.
replace
(
'{format}'
,
'json'
);
this
.
path
=
this
.
path
.
replace
(
'{format}'
,
'json'
);
this
.
method
=
this
.
method
.
toLowerCase
();
this
.
method
=
this
.
method
.
toLowerCase
();
this
.
isGetMethod
=
this
.
method
===
"get"
;
this
.
isGetMethod
=
this
.
method
===
'GET'
;
this
.
resourceName
=
this
.
resource
.
name
;
this
.
resourceName
=
this
.
resource
.
name
;
if
(
typeof
this
.
type
!==
'undefined'
&&
this
.
type
===
'void'
)
if
(
typeof
this
.
type
!==
'undefined'
&&
this
.
type
===
'void'
)
this
.
type
=
null
;
this
.
type
=
null
;
else
{
else
{
this
.
responseClassSignature
=
this
.
getSignature
(
this
.
type
,
this
.
resource
.
models
);
this
.
responseClassSignature
=
this
.
getSignature
(
this
.
type
,
this
.
resource
.
models
);
this
.
responseSampleJSON
=
this
.
getSampleJSON
(
this
.
type
,
this
.
resource
.
models
);
this
.
responseSampleJSON
=
this
.
getSampleJSON
(
this
.
type
,
this
.
resource
.
models
);
}
}
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
var
param
=
this
.
parameters
[
i
];
// might take this away
// might take this away
param
.
name
=
param
.
name
||
param
.
type
||
param
.
dataType
;
param
.
name
=
param
.
name
||
param
.
type
||
param
.
dataType
;
// for 1.1 compatibility
// for 1.1 compatibility
var
type
=
param
.
type
||
param
.
dataType
;
var
type
=
param
.
type
||
param
.
dataType
;
if
(
type
===
'array'
)
{
if
(
type
===
'array'
)
{
type
=
'array['
+
(
param
.
items
.
$ref
?
param
.
items
.
$ref
:
param
.
items
.
type
)
+
']'
;
type
=
'array['
+
(
param
.
items
.
$ref
?
param
.
items
.
$ref
:
param
.
items
.
type
)
+
']'
;
}
}
param
.
type
=
type
;
param
.
type
=
type
;
if
(
type
.
toLowerCase
()
===
'boolean'
)
{
if
(
type
&&
type
.
toLowerCase
()
===
'boolean'
)
{
param
.
allowableValues
=
{};
param
.
allowableValues
=
{};
param
.
allowableValues
.
values
=
[
"true"
,
"false"
];
param
.
allowableValues
.
values
=
[
'true'
,
'false'
];
}
}
param
.
signature
=
this
.
getSignature
(
type
,
this
.
resource
.
models
);
param
.
signature
=
this
.
getSignature
(
type
,
this
.
resource
.
models
);
param
.
sampleJSON
=
this
.
getSampleJSON
(
type
,
this
.
resource
.
models
);
param
.
sampleJSON
=
this
.
getSampleJSON
(
type
,
this
.
resource
.
models
);
var
enumValue
=
param
[
"enum"
];
var
enumValue
=
param
[
'enum'
];
if
(
enumValue
!=
null
)
{
if
(
enumValue
!=
null
)
{
param
.
isList
=
true
;
param
.
isList
=
true
;
param
.
allowableValues
=
{};
param
.
allowableValues
=
{};
param
.
allowableValues
.
descriptiveValues
=
[];
param
.
allowableValues
.
descriptiveValues
=
[];
for
(
var
j
=
0
;
j
<
enumValue
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
enumValue
.
length
;
j
++
)
{
var
v
=
enumValue
[
j
];
var
v
=
enumValue
[
j
];
if
(
param
.
defaultValue
!=
null
)
{
if
(
param
.
defaultValue
!=
null
)
{
param
.
allowableValues
.
descriptiveValues
.
push
({
param
.
allowableValues
.
descriptiveValues
.
push
({
value
:
String
(
v
),
value
:
String
(
v
),
isDefault
:
(
v
===
param
.
defaultValue
)
isDefault
:
(
v
===
param
.
defaultValue
)
});
});
}
}
else
{
else
{
param
.
allowableValues
.
descriptiveValues
.
push
({
param
.
allowableValues
.
descriptiveValues
.
push
({
value
:
String
(
v
),
value
:
String
(
v
),
isDefault
:
false
isDefault
:
false
});
});
}
}
}
}
}
}
else
if
(
param
.
allowableValues
!=
null
)
{
else
if
(
param
.
allowableValues
!=
null
)
{
if
(
param
.
allowableValues
.
valueType
===
"RANGE"
)
if
(
param
.
allowableValues
.
valueType
===
'RANGE'
)
param
.
isRange
=
true
;
param
.
isRange
=
true
;
else
else
param
.
isList
=
true
;
param
.
isList
=
true
;
if
(
param
.
allowableValues
!=
null
)
{
if
(
param
.
allowableValues
!=
null
)
{
param
.
allowableValues
.
descriptiveValues
=
[];
param
.
allowableValues
.
descriptiveValues
=
[];
if
(
param
.
allowableValues
.
values
)
{
if
(
param
.
allowableValues
.
values
)
{
for
(
var
j
=
0
;
j
<
param
.
allowableValues
.
values
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
param
.
allowableValues
.
values
.
length
;
j
++
)
{
var
v
=
param
.
allowableValues
.
values
[
j
];
var
v
=
param
.
allowableValues
.
values
[
j
];
if
(
param
.
defaultValue
!=
null
)
{
if
(
param
.
defaultValue
!=
null
)
{
param
.
allowableValues
.
descriptiveValues
.
push
({
param
.
allowableValues
.
descriptiveValues
.
push
({
value
:
String
(
v
),
value
:
String
(
v
),
isDefault
:
(
v
===
param
.
defaultValue
)
isDefault
:
(
v
===
param
.
defaultValue
)
});
});
}
}
else
{
else
{
param
.
allowableValues
.
descriptiveValues
.
push
({
param
.
allowableValues
.
descriptiveValues
.
push
({
value
:
String
(
v
),
value
:
String
(
v
),
isDefault
:
false
isDefault
:
false
});
});
...
@@ -766,24 +802,40 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
...
@@ -766,24 +802,40 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
}
}
}
}
}
}
param
.
defaultValue
=
applyParameterMacro
(
param
,
this
);
}
var
defaultSuccessCallback
=
this
.
resource
.
api
.
defaultSuccessCallback
||
null
;
var
defaultErrorCallback
=
this
.
resource
.
api
.
defaultErrorCallback
||
null
;
this
.
resource
[
this
.
nickname
]
=
function
(
args
,
opts
,
callback
,
error
)
{
var
arg1
=
args
,
arg2
=
opts
,
arg3
=
callback
||
defaultSuccessCallback
,
arg4
=
error
||
defaultErrorCallback
;
if
(
typeof
opts
===
'function'
)
{
arg2
=
{};
arg3
=
opts
;
arg4
=
error
;
}
}
this
.
resource
[
this
.
nickname
]
=
function
(
args
,
callback
,
error
)
{
return
_this
[
'do'
](
arg1
,
arg2
,
arg3
,
arg4
);
return
_this
[
"do"
](
args
,
callback
,
error
);
};
};
this
.
resource
[
this
.
nickname
].
help
=
function
()
{
this
.
resource
[
this
.
nickname
].
help
=
function
()
{
return
_this
.
help
();
return
_this
.
help
();
};
};
}
this
.
resource
[
this
.
nickname
].
asCurl
=
function
(
args
)
{
return
_this
.
asCurl
(
args
);
};
}
SwaggerOperation
.
prototype
.
isListType
=
function
(
type
)
{
SwaggerOperation
.
prototype
.
isListType
=
function
(
type
)
{
if
(
type
&&
type
.
indexOf
(
'['
)
>=
0
)
{
if
(
type
&&
type
.
indexOf
(
'['
)
>=
0
)
{
return
type
.
substring
(
type
.
indexOf
(
'['
)
+
1
,
type
.
indexOf
(
']'
));
return
type
.
substring
(
type
.
indexOf
(
'['
)
+
1
,
type
.
indexOf
(
']'
));
}
else
{
}
else
{
return
void
0
;
return
void
0
;
}
}
};
};
SwaggerOperation
.
prototype
.
getSignature
=
function
(
type
,
models
)
{
SwaggerOperation
.
prototype
.
getSignature
=
function
(
type
,
models
)
{
var
isPrimitive
,
listType
;
var
isPrimitive
,
listType
;
listType
=
this
.
isListType
(
type
);
listType
=
this
.
isListType
(
type
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
type
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
type
]
!=
null
)
?
false
:
true
;
...
@@ -796,23 +848,23 @@ SwaggerOperation.prototype.getSignature = function(type, models) {
...
@@ -796,23 +848,23 @@ SwaggerOperation.prototype.getSignature = function(type, models) {
return
models
[
type
].
getMockSignature
();
return
models
[
type
].
getMockSignature
();
}
}
}
}
};
};
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
type
,
models
)
{
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
type
,
models
)
{
var
isPrimitive
,
listType
,
val
;
var
isPrimitive
,
listType
,
val
;
listType
=
this
.
isListType
(
type
);
listType
=
this
.
isListType
(
type
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
type
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
type
]
!=
null
)
?
false
:
true
;
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
type
].
createJSONSample
());
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
type
].
createJSONSample
());
if
(
val
)
{
if
(
val
)
{
val
=
listType
?
[
val
]
:
val
;
val
=
listType
?
[
val
]
:
val
;
if
(
typeof
val
==
"string"
)
if
(
typeof
val
==
'string'
)
return
val
;
return
val
;
else
if
(
typeof
val
===
"object"
)
{
else
if
(
typeof
val
===
'object'
)
{
var
t
=
val
;
var
t
=
val
;
if
(
val
instanceof
Array
&&
val
.
length
>
0
)
{
if
(
val
instanceof
Array
&&
val
.
length
>
0
)
{
t
=
val
[
0
];
t
=
val
[
0
];
}
}
if
(
t
.
nodeName
)
{
if
(
t
.
nodeName
)
{
var
xmlString
=
new
XMLSerializer
().
serializeToString
(
t
);
var
xmlString
=
new
XMLSerializer
().
serializeToString
(
t
);
return
this
.
formatXml
(
xmlString
);
return
this
.
formatXml
(
xmlString
);
}
}
...
@@ -822,42 +874,37 @@ SwaggerOperation.prototype.getSampleJSON = function(type, models) {
...
@@ -822,42 +874,37 @@ SwaggerOperation.prototype.getSampleJSON = function(type, models) {
else
else
return
val
;
return
val
;
}
}
};
};
SwaggerOperation
.
prototype
[
"do"
]
=
function
(
args
,
opts
,
callback
,
error
)
{
SwaggerOperation
.
prototype
[
'do'
]
=
function
(
args
,
opts
,
callback
,
error
)
{
var
key
,
param
,
params
,
possibleParams
,
req
,
requestContentType
,
responseContentType
,
value
,
_i
,
_len
,
_ref
;
var
key
,
param
,
params
,
possibleParams
,
req
,
value
;
if
(
args
==
null
)
{
args
=
args
||
{};
args
=
{};
opts
=
opts
||
{};
}
if
(
opts
==
null
)
{
if
((
typeof
args
)
===
'function'
)
{
opts
=
{};
}
requestContentType
=
null
;
responseContentType
=
null
;
if
((
typeof
args
)
===
"function"
)
{
error
=
opts
;
error
=
opts
;
callback
=
args
;
callback
=
args
;
args
=
{};
args
=
{};
}
}
if
((
typeof
opts
)
===
"function"
)
{
if
((
typeof
opts
)
===
'function'
)
{
error
=
callback
;
error
=
callback
;
callback
=
opts
;
callback
=
opts
;
}
}
if
(
error
==
null
)
{
if
(
error
==
null
)
{
error
=
function
(
xhr
,
textStatus
,
error
)
{
error
=
function
(
xhr
,
textStatus
,
error
)
{
return
log
(
xhr
,
textStatus
,
error
);
return
log
(
xhr
,
textStatus
,
error
);
};
};
}
}
if
(
callback
==
null
)
{
if
(
callback
==
null
)
{
callback
=
function
(
response
)
{
callback
=
function
(
response
)
{
var
content
;
var
content
;
content
=
null
;
content
=
null
;
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
content
=
response
.
data
;
content
=
response
.
data
;
}
else
{
}
else
{
content
=
"no data"
;
content
=
'no data'
;
}
}
return
log
(
"default callback: "
+
content
);
return
log
(
'default callback: '
+
content
);
};
};
}
}
params
=
{};
params
=
{};
...
@@ -866,16 +913,29 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
...
@@ -866,16 +913,29 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
params
.
headers
=
args
.
headers
;
params
.
headers
=
args
.
headers
;
delete
args
.
headers
;
delete
args
.
headers
;
}
}
// allow override from the opts
if
(
opts
&&
opts
.
responseContentType
)
{
params
.
headers
[
'Content-Type'
]
=
opts
.
responseContentType
;
}
if
(
opts
&&
opts
.
requestContentType
)
{
params
.
headers
[
'Accept'
]
=
opts
.
requestContentType
;
}
var
possibleParams
=
[];
var
possibleParams
=
[];
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
var
param
=
this
.
parameters
[
i
];
if
(
param
.
paramType
===
'header'
)
{
if
(
param
.
paramType
===
'header'
)
{
if
(
args
[
param
.
name
]
)
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
params
.
headers
[
param
.
name
]
=
args
[
param
.
name
];
params
.
headers
[
param
.
name
]
=
args
[
param
.
name
];
}
}
else
if
(
param
.
paramType
===
'form'
||
param
.
paramType
.
toLowerCase
()
===
'file'
)
else
if
(
param
.
paramType
===
'form'
||
param
.
paramType
.
toLowerCase
()
===
'file'
)
possibleParams
.
push
(
param
);
possibleParams
.
push
(
param
);
else
if
(
param
.
paramType
===
'body'
&&
param
.
name
!==
'body'
&&
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
if
(
args
.
body
)
{
throw
new
Error
(
'Saw two body params in an API listing; expecting a max of one.'
);
}
args
.
body
=
args
[
param
.
name
];
}
}
}
if
(
args
.
body
!=
null
)
{
if
(
args
.
body
!=
null
)
{
...
@@ -886,95 +946,109 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
...
@@ -886,95 +946,109 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
if
(
possibleParams
)
{
if
(
possibleParams
)
{
var
key
;
var
key
;
for
(
key
in
possibleParams
)
{
for
(
key
in
possibleParams
)
{
value
=
possibleParams
[
key
];
var
value
=
possibleParams
[
key
];
if
(
args
[
value
.
name
])
{
if
(
args
[
value
.
name
])
{
params
[
value
.
name
]
=
args
[
value
.
name
];
params
[
value
.
name
]
=
args
[
value
.
name
];
}
}
}
}
}
}
req
=
new
SwaggerRequest
(
this
.
method
,
this
.
urlify
(
args
),
params
,
opts
,
callback
,
error
,
this
);
req
=
new
SwaggerRequest
(
this
.
method
,
this
.
urlify
(
args
),
params
,
opts
,
callback
,
error
,
this
);
if
(
opts
.
mock
!=
null
)
{
if
(
opts
.
mock
!=
null
)
{
return
req
;
return
req
;
}
else
{
}
else
{
return
true
;
return
true
;
}
}
};
};
SwaggerOperation
.
prototype
.
pathJson
=
function
()
{
SwaggerOperation
.
prototype
.
pathJson
=
function
()
{
return
this
.
path
.
replace
(
"{format}"
,
"json"
);
return
this
.
path
.
replace
(
'{format}'
,
'json'
);
};
};
SwaggerOperation
.
prototype
.
pathXml
=
function
()
{
SwaggerOperation
.
prototype
.
pathXml
=
function
()
{
return
this
.
path
.
replace
(
"{format}"
,
"xml"
);
return
this
.
path
.
replace
(
'{format}'
,
'xml'
);
};
};
SwaggerOperation
.
prototype
.
encodePathParam
=
function
(
pathParam
)
{
SwaggerOperation
.
prototype
.
encodePathParam
=
function
(
pathParam
)
{
var
encParts
,
part
,
parts
,
_i
,
_len
;
var
encParts
,
part
,
parts
,
_i
,
_len
;
pathParam
=
pathParam
.
toString
();
pathParam
=
pathParam
.
toString
();
if
(
pathParam
.
indexOf
(
"/"
)
===
-
1
)
{
if
(
pathParam
.
indexOf
(
'/'
)
===
-
1
)
{
return
encodeURIComponent
(
pathParam
);
return
encodeURIComponent
(
pathParam
);
}
else
{
}
else
{
parts
=
pathParam
.
split
(
"/"
);
parts
=
pathParam
.
split
(
'/'
);
encParts
=
[];
encParts
=
[];
for
(
_i
=
0
,
_len
=
parts
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
parts
.
length
;
_i
<
_len
;
_i
++
)
{
part
=
parts
[
_i
];
part
=
parts
[
_i
];
encParts
.
push
(
encodeURIComponent
(
part
));
encParts
.
push
(
encodeURIComponent
(
part
));
}
}
return
encParts
.
join
(
"/"
);
return
encParts
.
join
(
'/'
);
}
}
};
};
SwaggerOperation
.
prototype
.
urlify
=
function
(
args
)
{
SwaggerOperation
.
prototype
.
urlify
=
function
(
args
)
{
var
url
=
this
.
resource
.
basePath
+
this
.
pathJson
();
var
url
=
this
.
resource
.
basePath
+
this
.
pathJson
();
var
params
=
this
.
parameters
;
var
params
=
this
.
parameters
;
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
var
param
=
params
[
i
];
var
param
=
params
[
i
];
if
(
param
.
paramType
===
'path'
)
{
if
(
param
.
paramType
===
'path'
)
{
if
(
args
[
param
.
name
]
)
{
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
// apply path params and remove from args
// apply path params and remove from args
var
reg
=
new
RegExp
(
'\{'
+
param
.
name
+
'[^\}]*\}
'
,
'gi'
);
var
reg
=
new
RegExp
(
'\\{\\s*?'
+
param
.
name
+
'.*?\\}(?=\\s*?(\\/?|$))
'
,
'gi'
);
url
=
url
.
replace
(
reg
,
this
.
encodePathParam
(
args
[
param
.
name
]));
url
=
url
.
replace
(
reg
,
this
.
encodePathParam
(
args
[
param
.
name
]));
delete
args
[
param
.
name
];
delete
args
[
param
.
name
];
}
}
else
else
throw
""
+
param
.
name
+
" is a required path param."
;
throw
''
+
param
.
name
+
' is a required path param.'
;
}
}
}
}
var
queryParams
=
""
;
var
queryParams
=
''
;
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
var
param
=
params
[
i
];
var
param
=
params
[
i
];
if
(
param
.
paramType
===
'query'
)
{
if
(
param
.
paramType
===
'query'
)
{
if
(
args
[
param
.
name
]
!==
undefined
)
{
if
(
queryParams
!==
''
)
if
(
queryParams
!==
''
)
queryParams
+=
"&"
;
queryParams
+=
'&'
;
if
(
Array
.
isArray
(
param
))
{
var
j
;
var
output
=
''
;
for
(
j
=
0
;
j
<
param
.
length
;
j
++
)
{
if
(
j
>
0
)
output
+=
','
;
output
+=
encodeURIComponent
(
param
[
j
]);
}
queryParams
+=
encodeURIComponent
(
param
.
name
)
+
'='
+
output
;
}
else
{
if
(
typeof
args
[
param
.
name
]
!==
'undefined'
)
{
queryParams
+=
encodeURIComponent
(
param
.
name
)
+
'='
+
encodeURIComponent
(
args
[
param
.
name
]);
queryParams
+=
encodeURIComponent
(
param
.
name
)
+
'='
+
encodeURIComponent
(
args
[
param
.
name
]);
}
else
{
if
(
param
.
required
)
throw
''
+
param
.
name
+
' is a required query param.'
;
}
}
}
}
}
}
}
if
((
queryParams
!=
null
)
&&
queryParams
.
length
>
0
)
if
((
queryParams
!=
null
)
&&
queryParams
.
length
>
0
)
url
+=
'?'
+
queryParams
;
url
+=
'?'
+
queryParams
;
return
url
;
return
url
;
};
};
SwaggerOperation
.
prototype
.
supportHeaderParams
=
function
()
{
SwaggerOperation
.
prototype
.
supportHeaderParams
=
function
()
{
return
this
.
resource
.
api
.
supportHeaderParams
;
return
this
.
resource
.
api
.
supportHeaderParams
;
};
};
SwaggerOperation
.
prototype
.
supportedSubmitMethods
=
function
()
{
SwaggerOperation
.
prototype
.
supportedSubmitMethods
=
function
()
{
return
this
.
resource
.
api
.
supportedSubmitMethods
;
return
this
.
resource
.
api
.
supportedSubmitMethods
;
};
};
SwaggerOperation
.
prototype
.
getQueryParams
=
function
(
args
)
{
SwaggerOperation
.
prototype
.
getQueryParams
=
function
(
args
)
{
return
this
.
getMatchingParams
([
'query'
],
args
);
return
this
.
getMatchingParams
([
'query'
],
args
);
};
};
SwaggerOperation
.
prototype
.
getHeaderParams
=
function
(
args
)
{
SwaggerOperation
.
prototype
.
getHeaderParams
=
function
(
args
)
{
return
this
.
getMatchingParams
([
'header'
],
args
);
return
this
.
getMatchingParams
([
'header'
],
args
);
};
};
SwaggerOperation
.
prototype
.
getMatchingParams
=
function
(
paramTypes
,
args
)
{
SwaggerOperation
.
prototype
.
getMatchingParams
=
function
(
paramTypes
,
args
)
{
var
matchingParams
=
{};
var
matchingParams
=
{};
var
params
=
this
.
parameters
;
var
params
=
this
.
parameters
;
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
...
@@ -989,22 +1063,40 @@ SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
...
@@ -989,22 +1063,40 @@ SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
matchingParams
[
name
]
=
value
;
matchingParams
[
name
]
=
value
;
}
}
return
matchingParams
;
return
matchingParams
;
};
};
SwaggerOperation
.
prototype
.
help
=
function
()
{
SwaggerOperation
.
prototype
.
help
=
function
()
{
var
msg
=
""
;
var
msg
=
''
;
var
params
=
this
.
parameters
;
var
params
=
this
.
parameters
;
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
var
param
=
params
[
i
];
var
param
=
params
[
i
];
if
(
msg
!==
""
)
if
(
msg
!==
''
)
msg
+=
"\n"
;
msg
+=
'\n'
;
msg
+=
"* "
+
param
.
name
+
(
param
.
required
?
' (required)'
:
''
)
+
" - "
+
param
.
description
;
msg
+=
'* '
+
param
.
name
+
(
param
.
required
?
' (required)'
:
''
)
+
" - "
+
param
.
description
;
}
}
return
msg
;
return
msg
;
};
};
SwaggerOperation
.
prototype
.
asCurl
=
function
(
args
)
{
var
results
=
[];
var
i
;
var
headers
=
SwaggerRequest
.
prototype
.
setHeaders
(
args
,
{},
this
);
for
(
i
=
0
;
i
<
this
.
parameters
.
length
;
i
++
)
{
var
param
=
this
.
parameters
[
i
];
if
(
param
.
paramType
&&
param
.
paramType
===
'header'
&&
args
[
param
.
name
])
{
headers
[
param
.
name
]
=
args
[
param
.
name
];
}
}
var
key
;
for
(
key
in
headers
)
{
results
.
push
(
'--header "'
+
key
+
': '
+
headers
[
key
]
+
'"'
);
}
return
'curl '
+
(
results
.
join
(
' '
))
+
' '
+
this
.
urlify
(
args
);
};
SwaggerOperation
.
prototype
.
formatXml
=
function
(
xml
)
{
SwaggerOperation
.
prototype
.
formatXml
=
function
(
xml
)
{
var
contexp
,
formatted
,
indent
,
lastType
,
lines
,
ln
,
pad
,
reg
,
transitions
,
wsexp
,
_fn
,
_i
,
_len
;
var
contexp
,
formatted
,
indent
,
lastType
,
lines
,
ln
,
pad
,
reg
,
transitions
,
wsexp
,
_fn
,
_i
,
_len
;
reg
=
/
(
>
)(
<
)(\/
*
)
/g
;
reg
=
/
(
>
)(
<
)(\/
*
)
/g
;
wsexp
=
/
[
]
*
(
.*
)[
]
+
\n
/g
;
wsexp
=
/
[
]
*
(
.*
)[
]
+
\n
/g
;
...
@@ -1033,14 +1125,14 @@ SwaggerOperation.prototype.formatXml = function(xml) {
...
@@ -1033,14 +1125,14 @@ SwaggerOperation.prototype.formatXml = function(xml) {
'other->opening'
:
0
,
'other->opening'
:
0
,
'other->other'
:
0
'other->other'
:
0
};
};
_fn
=
function
(
ln
)
{
_fn
=
function
(
ln
)
{
var
fromTo
,
j
,
key
,
padding
,
type
,
types
,
value
;
var
fromTo
,
j
,
key
,
padding
,
type
,
types
,
value
;
types
=
{
types
=
{
single
:
Boolean
(
ln
.
match
(
/<.+
\/
>/
)),
single
:
Boolean
(
ln
.
match
(
/<.+
\/
>/
)),
closing
:
Boolean
(
ln
.
match
(
/<
\/
.+>/
)),
closing
:
Boolean
(
ln
.
match
(
/<
\/
.+>/
)),
opening
:
Boolean
(
ln
.
match
(
/<
[^
!?
]
.*>/
))
opening
:
Boolean
(
ln
.
match
(
/<
[^
!?
]
.*>/
))
};
};
type
=
((
function
()
{
type
=
((
function
()
{
var
_results
;
var
_results
;
_results
=
[];
_results
=
[];
for
(
key
in
types
)
{
for
(
key
in
types
)
{
...
@@ -1056,7 +1148,7 @@ SwaggerOperation.prototype.formatXml = function(xml) {
...
@@ -1056,7 +1148,7 @@ SwaggerOperation.prototype.formatXml = function(xml) {
lastType
=
type
;
lastType
=
type
;
padding
=
''
;
padding
=
''
;
indent
+=
transitions
[
fromTo
];
indent
+=
transitions
[
fromTo
];
padding
=
((
function
()
{
padding
=
((
function
()
{
var
_j
,
_ref5
,
_results
;
var
_j
,
_ref5
,
_results
;
_results
=
[];
_results
=
[];
for
(
j
=
_j
=
0
,
_ref5
=
indent
;
0
<=
_ref5
?
_j
<
_ref5
:
_j
>
_ref5
;
j
=
0
<=
_ref5
?
++
_j
:
--
_j
)
{
for
(
j
=
_j
=
0
,
_ref5
=
indent
;
0
<=
_ref5
?
_j
<
_ref5
:
_j
>
_ref5
;
j
=
0
<=
_ref5
?
++
_j
:
--
_j
)
{
...
@@ -1075,137 +1167,106 @@ SwaggerOperation.prototype.formatXml = function(xml) {
...
@@ -1075,137 +1167,106 @@ SwaggerOperation.prototype.formatXml = function(xml) {
_fn
(
ln
);
_fn
(
ln
);
}
}
return
formatted
;
return
formatted
;
};
};
var
SwaggerRequest
=
function
(
type
,
url
,
params
,
opts
,
successCallback
,
errorCallback
,
operation
,
execution
)
{
var
SwaggerRequest
=
function
(
type
,
url
,
params
,
opts
,
successCallback
,
errorCallback
,
operation
,
execution
)
{
var
_this
=
this
;
var
_this
=
this
;
var
errors
=
[];
var
errors
=
[];
this
.
useJQuery
=
(
typeof
operation
.
resource
.
useJQuery
!==
'undefined'
?
operation
.
resource
.
useJQuery
:
null
);
this
.
useJQuery
=
(
typeof
operation
.
resource
.
useJQuery
!==
'undefined'
?
operation
.
resource
.
useJQuery
:
null
);
this
.
type
=
(
type
||
errors
.
push
(
"SwaggerRequest type is required (get/post/put/delete/patch/options)."
));
this
.
type
=
(
type
||
errors
.
push
(
'SwaggerRequest type is required (get/post/put/delete/patch/options).'
));
this
.
url
=
(
url
||
errors
.
push
(
"SwaggerRequest url is required."
));
this
.
url
=
(
url
||
errors
.
push
(
'SwaggerRequest url is required.'
));
this
.
params
=
params
;
this
.
params
=
params
;
this
.
opts
=
opts
;
this
.
opts
=
opts
;
this
.
successCallback
=
(
successCallback
||
errors
.
push
(
"SwaggerRequest successCallback is required."
));
this
.
successCallback
=
(
successCallback
||
errors
.
push
(
'SwaggerRequest successCallback is required.'
));
this
.
errorCallback
=
(
errorCallback
||
errors
.
push
(
"SwaggerRequest error callback is required."
));
this
.
errorCallback
=
(
errorCallback
||
errors
.
push
(
'SwaggerRequest error callback is required.'
));
this
.
operation
=
(
operation
||
errors
.
push
(
"SwaggerRequest operation is required."
));
this
.
operation
=
(
operation
||
errors
.
push
(
'SwaggerRequest operation is required.'
));
this
.
execution
=
execution
;
this
.
execution
=
execution
;
this
.
headers
=
(
params
.
headers
||
{});
this
.
headers
=
(
params
.
headers
||
{});
if
(
errors
.
length
>
0
)
{
if
(
errors
.
length
>
0
)
{
throw
errors
;
throw
errors
;
}
}
this
.
type
=
this
.
type
.
toUpperCase
();
this
.
type
=
this
.
type
.
toUpperCase
();
var
myHeaders
=
{};
// set request, response content type headers
var
headers
=
this
.
setHeaders
(
params
,
opts
,
this
.
operation
);
var
body
=
params
.
body
;
var
body
=
params
.
body
;
var
parent
=
params
[
"parent"
];
var
requestContentType
=
"application/json"
;
var
formParams
=
[];
var
fileParams
=
[];
var
params
=
this
.
operation
.
parameters
;
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
var
param
=
params
[
i
];
if
(
param
.
paramType
===
"form"
)
formParams
.
push
(
param
);
else
if
(
param
.
paramType
===
"file"
)
fileParams
.
push
(
param
);
}
if
(
body
&&
(
this
.
type
===
"POST"
||
this
.
type
===
"PUT"
||
this
.
type
===
"PATCH"
))
{
if
(
this
.
opts
.
requestContentType
)
{
requestContentType
=
this
.
opts
.
requestContentType
;
}
}
else
{
// if any form params, content type must be set
if
(
formParams
.
length
>
0
)
{
if
(
fileParams
.
length
>
0
)
requestContentType
=
"multipart/form-data"
;
else
requestContentType
=
"application/x-www-form-urlencoded"
;
}
else
if
(
this
.
type
==
"DELETE"
)
body
=
"{}"
;
else
if
(
this
.
type
!=
"DELETE"
)
requestContentType
=
null
;
}
if
(
requestContentType
&&
this
.
operation
.
consumes
)
{
// encode the body for form submits
if
(
this
.
operation
.
consumes
[
requestContentType
]
===
'undefined'
)
{
if
(
headers
[
'Content-Type'
])
{
log
(
"server doesn't consume "
+
requestContentType
+
", try "
+
JSON
.
stringify
(
this
.
operation
.
consumes
));
if
(
this
.
requestContentType
===
null
)
{
requestContentType
=
this
.
operation
.
consumes
[
0
];
}
}
}
var
responseContentType
=
null
;
if
(
this
.
opts
.
responseContentType
)
{
responseContentType
=
this
.
opts
.
responseContentType
;
}
else
{
responseContentType
=
"application/json"
;
}
if
(
responseContentType
&&
this
.
operation
.
produces
)
{
if
(
this
.
operation
.
produces
[
responseContentType
]
===
'undefined'
)
{
log
(
"server can't produce "
+
responseContentType
);
}
}
if
(
requestContentType
&&
requestContentType
.
indexOf
(
"application/x-www-form-urlencoded"
)
===
0
)
{
var
fields
=
{};
var
possibleParams
=
{};
var
values
=
{};
var
values
=
{};
var
key
;
var
i
;
for
(
key
in
formParams
){
var
operationParams
=
this
.
operation
.
parameters
;
var
param
=
formParams
[
key
];
for
(
i
=
0
;
i
<
operationParams
.
length
;
i
++
)
{
var
param
=
operationParams
[
i
];
if
(
param
.
paramType
===
'form'
)
values
[
param
.
name
]
=
param
;
values
[
param
.
name
]
=
param
;
}
}
var
encoded
=
""
;
if
(
headers
[
'Content-Type'
].
indexOf
(
'application/x-www-form-urlencoded'
)
===
0
)
{
var
key
;
var
encoded
=
''
;
for
(
key
in
values
)
{
var
key
,
value
;
for
(
key
in
values
)
{
value
=
this
.
params
[
key
];
value
=
this
.
params
[
key
];
if
(
typeof
value
!==
'undefined'
)
{
if
(
typeof
value
!==
'undefined'
)
{
if
(
encoded
!==
""
)
if
(
encoded
!==
''
)
encoded
+=
"&"
;
encoded
+=
'&'
;
encoded
+=
encodeURIComponent
(
key
)
+
'='
+
encodeURIComponent
(
value
);
encoded
+=
encodeURIComponent
(
key
)
+
'='
+
encodeURIComponent
(
value
);
}
}
}
}
body
=
encoded
;
body
=
encoded
;
}
}
var
name
;
else
if
(
headers
[
'Content-Type'
].
indexOf
(
'multipart/form-data'
)
===
0
)
{
for
(
name
in
this
.
headers
)
// encode the body for form submits
myHeaders
[
name
]
=
this
.
headers
[
name
];
var
data
=
''
;
if
((
requestContentType
&&
body
!==
""
)
||
(
requestContentType
===
"application/x-www-form-urlencoded"
))
var
boundary
=
'----SwaggerFormBoundary'
+
Date
.
now
();
myHeaders
[
"Content-Type"
]
=
requestContentType
;
var
key
,
value
;
if
(
responseContentType
)
for
(
key
in
values
)
{
myHeaders
[
"Accept"
]
=
responseContentType
;
value
=
this
.
params
[
key
];
if
(
typeof
value
!==
'undefined'
)
{
data
+=
'--'
+
boundary
+
'\n'
;
data
+=
'Content-Disposition: form-data; name="'
+
key
+
'"'
;
data
+=
'\n\n'
;
data
+=
value
+
'\n'
;
}
}
data
+=
'--'
+
boundary
+
'--\n'
;
headers
[
'Content-Type'
]
=
'multipart/form-data; boundary='
+
boundary
;
body
=
data
;
}
}
var
obj
;
if
(
!
((
this
.
headers
!=
null
)
&&
(
this
.
headers
.
mock
!=
null
)))
{
if
(
!
((
this
.
headers
!=
null
)
&&
(
this
.
headers
.
mock
!=
null
)))
{
obj
=
{
obj
=
{
url
:
this
.
url
,
url
:
this
.
url
,
method
:
this
.
type
,
method
:
this
.
type
,
headers
:
myH
eaders
,
headers
:
h
eaders
,
body
:
body
,
body
:
body
,
useJQuery
:
this
.
useJQuery
,
useJQuery
:
this
.
useJQuery
,
on
:
{
on
:
{
error
:
function
(
response
)
{
error
:
function
(
response
)
{
return
_this
.
errorCallback
(
response
,
_this
.
opts
.
parent
);
return
_this
.
errorCallback
(
response
,
_this
.
opts
.
parent
);
},
},
redirect
:
function
(
response
)
{
redirect
:
function
(
response
)
{
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
},
},
307
:
function
(
response
)
{
307
:
function
(
response
)
{
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
},
},
response
:
function
(
response
)
{
response
:
function
(
response
)
{
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
return
_this
.
successCallback
(
response
,
_this
.
opts
.
parent
);
}
}
}
}
};
};
var
status
=
false
;
if
(
this
.
operation
.
resource
&&
this
.
operation
.
resource
.
api
&&
this
.
operation
.
resource
.
api
.
clientAuthorizations
)
{
// Get the client authorizations from the resource declaration
status
=
this
.
operation
.
resource
.
api
.
clientAuthorizations
.
apply
(
obj
,
this
.
operation
.
authorizations
);
}
else
{
// Get the client authorization from the default authorization declaration
var
e
;
var
e
;
if
(
typeof
window
!==
'undefined'
)
{
if
(
typeof
window
!==
'undefined'
)
{
e
=
window
;
e
=
window
;
...
@@ -1213,6 +1274,8 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
...
@@ -1213,6 +1274,8 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
e
=
exports
;
e
=
exports
;
}
}
status
=
e
.
authorizations
.
apply
(
obj
,
this
.
operation
.
authorizations
);
status
=
e
.
authorizations
.
apply
(
obj
,
this
.
operation
.
authorizations
);
}
if
(
opts
.
mock
==
null
)
{
if
(
opts
.
mock
==
null
)
{
if
(
status
!==
false
)
{
if
(
status
!==
false
)
{
new
SwaggerHttp
().
execute
(
obj
);
new
SwaggerHttp
().
execute
(
obj
);
...
@@ -1223,37 +1286,96 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
...
@@ -1223,37 +1286,96 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
return
obj
;
return
obj
;
}
}
}
}
};
return
obj
;
};
SwaggerRequest
.
prototype
.
asCurl
=
function
()
{
SwaggerRequest
.
prototype
.
setHeaders
=
function
(
params
,
opts
,
operation
)
{
var
results
=
[];
// default type
if
(
this
.
headers
)
{
var
accepts
=
opts
.
responseContentType
||
'application/json'
;
var
key
;
var
consumes
=
opts
.
requestContentType
||
'application/json'
;
for
(
key
in
this
.
headers
)
{
results
.
push
(
"--header \""
+
key
+
": "
+
this
.
headers
[
v
]
+
"\""
);
var
allDefinedParams
=
operation
.
parameters
;
var
definedFormParams
=
[];
var
definedFileParams
=
[];
var
body
=
params
.
body
;
var
headers
=
{};
// get params from the operation and set them in definedFileParams, definedFormParams, headers
var
i
;
for
(
i
=
0
;
i
<
allDefinedParams
.
length
;
i
++
)
{
var
param
=
allDefinedParams
[
i
];
if
(
param
.
paramType
===
'form'
)
definedFormParams
.
push
(
param
);
else
if
(
param
.
paramType
===
'file'
)
definedFileParams
.
push
(
param
);
else
if
(
param
.
paramType
===
'header'
&&
this
.
params
.
headers
)
{
var
key
=
param
.
name
;
var
headerValue
=
this
.
params
.
headers
[
param
.
name
];
if
(
typeof
this
.
params
.
headers
[
param
.
name
]
!==
'undefined'
)
headers
[
key
]
=
headerValue
;
}
}
// if there's a body, need to set the accepts header via requestContentType
if
(
body
&&
(
this
.
type
===
'POST'
||
this
.
type
===
'PUT'
||
this
.
type
===
'PATCH'
||
this
.
type
===
'DELETE'
))
{
if
(
this
.
opts
.
requestContentType
)
consumes
=
this
.
opts
.
requestContentType
;
}
else
{
// if any form params, content type must be set
if
(
definedFormParams
.
length
>
0
)
{
if
(
definedFileParams
.
length
>
0
)
consumes
=
'multipart/form-data'
;
else
consumes
=
'application/x-www-form-urlencoded'
;
}
}
else
if
(
this
.
type
===
'DELETE'
)
body
=
'{}'
;
else
if
(
this
.
type
!=
'DELETE'
)
consumes
=
null
;
}
}
return
"curl "
+
(
results
.
join
(
" "
))
+
" "
+
this
.
url
;
};
/**
if
(
consumes
&&
this
.
operation
.
consumes
)
{
if
(
this
.
operation
.
consumes
.
indexOf
(
consumes
)
===
-
1
)
{
log
(
'server doesn\'t consume '
+
consumes
+
', try '
+
JSON
.
stringify
(
this
.
operation
.
consumes
));
}
}
if
(
this
.
opts
&&
this
.
opts
.
responseContentType
)
{
accepts
=
this
.
opts
.
responseContentType
;
}
else
{
accepts
=
'application/json'
;
}
if
(
accepts
&&
operation
.
produces
)
{
if
(
operation
.
produces
.
indexOf
(
accepts
)
===
-
1
)
{
log
(
'server can\'t produce '
+
accepts
);
}
}
if
((
consumes
&&
body
!==
''
)
||
(
consumes
===
'application/x-www-form-urlencoded'
))
headers
[
'Content-Type'
]
=
consumes
;
if
(
accepts
)
headers
[
'Accept'
]
=
accepts
;
return
headers
;
}
/**
* SwaggerHttp is a wrapper for executing requests
* SwaggerHttp is a wrapper for executing requests
*/
*/
var
SwaggerHttp
=
function
()
{
};
var
SwaggerHttp
=
function
()
{
};
SwaggerHttp
.
prototype
.
execute
=
function
(
obj
)
{
SwaggerHttp
.
prototype
.
execute
=
function
(
obj
)
{
if
(
obj
&&
(
typeof
obj
.
useJQuery
===
'boolean'
))
if
(
obj
&&
(
typeof
obj
.
useJQuery
===
'boolean'
))
this
.
useJQuery
=
obj
.
useJQuery
;
this
.
useJQuery
=
obj
.
useJQuery
;
else
else
this
.
useJQuery
=
this
.
isIE8
();
this
.
useJQuery
=
this
.
isIE8
();
if
(
this
.
useJQuery
)
if
(
this
.
useJQuery
)
return
new
JQueryHttpClient
().
execute
(
obj
);
return
new
JQueryHttpClient
().
execute
(
obj
);
else
else
return
new
ShredHttpClient
().
execute
(
obj
);
return
new
ShredHttpClient
().
execute
(
obj
);
}
}
SwaggerHttp
.
prototype
.
isIE8
=
function
()
{
SwaggerHttp
.
prototype
.
isIE8
=
function
()
{
var
detectedIE
=
false
;
var
detectedIE
=
false
;
if
(
typeof
navigator
!==
'undefined'
&&
navigator
.
userAgent
)
{
if
(
typeof
navigator
!==
'undefined'
&&
navigator
.
userAgent
)
{
nav
=
navigator
.
userAgent
.
toLowerCase
();
nav
=
navigator
.
userAgent
.
toLowerCase
();
...
@@ -1265,36 +1387,36 @@ SwaggerHttp.prototype.isIE8 = function() {
...
@@ -1265,36 +1387,36 @@ SwaggerHttp.prototype.isIE8 = function() {
}
}
}
}
return
detectedIE
;
return
detectedIE
;
};
};
/*
/*
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
* Since we are using closures here we need to alias it for internal use.
* Since we are using closures here we need to alias it for internal use.
*/
*/
var
JQueryHttpClient
=
function
(
options
)
{
var
JQueryHttpClient
=
function
(
options
)
{
"use strict"
;
this
.
options
=
options
||
{}
;
if
(
!
jQuery
)
{
if
(
!
jQuery
)
{
var
jQuery
=
window
.
jQuery
;
var
jQuery
=
window
.
jQuery
;
}
}
}
}
JQueryHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
JQueryHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
var
cb
=
obj
.
on
;
var
cb
=
obj
.
on
;
var
request
=
obj
;
var
request
=
obj
;
obj
.
type
=
obj
.
method
;
obj
.
type
=
obj
.
method
;
obj
.
cache
=
false
;
obj
.
cache
=
false
;
obj
.
beforeSend
=
function
(
xhr
)
{
obj
.
beforeSend
=
function
(
xhr
)
{
var
key
,
results
;
var
key
,
results
;
if
(
obj
.
headers
)
{
if
(
obj
.
headers
)
{
results
=
[];
results
=
[];
var
key
;
var
key
;
for
(
key
in
obj
.
headers
)
{
for
(
key
in
obj
.
headers
)
{
if
(
key
.
toLowerCase
()
===
"content-type"
)
{
if
(
key
.
toLowerCase
()
===
'content-type'
)
{
results
.
push
(
obj
.
contentType
=
obj
.
headers
[
key
]);
results
.
push
(
obj
.
contentType
=
obj
.
headers
[
key
]);
}
else
if
(
key
.
toLowerCase
()
===
"accept"
)
{
}
else
if
(
key
.
toLowerCase
()
===
'accept'
)
{
results
.
push
(
obj
.
accepts
=
obj
.
headers
[
key
]);
results
.
push
(
obj
.
accepts
=
obj
.
headers
[
key
]);
}
else
{
}
else
{
results
.
push
(
xhr
.
setRequestHeader
(
key
,
obj
.
headers
[
key
]));
results
.
push
(
xhr
.
setRequestHeader
(
key
,
obj
.
headers
[
key
]));
...
@@ -1305,16 +1427,16 @@ JQueryHttpClient.prototype.execute = function(obj) {
...
@@ -1305,16 +1427,16 @@ JQueryHttpClient.prototype.execute = function(obj) {
};
};
obj
.
data
=
obj
.
body
;
obj
.
data
=
obj
.
body
;
obj
.
complete
=
function
(
response
,
textStatus
,
opts
)
{
obj
.
complete
=
function
(
response
)
{
var
headers
=
{},
var
headers
=
{},
headerArray
=
response
.
getAllResponseHeaders
().
split
(
"\n"
);
headerArray
=
response
.
getAllResponseHeaders
().
split
(
'\n'
);
for
(
var
i
=
0
;
i
<
headerArray
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
headerArray
.
length
;
i
++
)
{
var
toSplit
=
headerArray
[
i
].
trim
();
var
toSplit
=
headerArray
[
i
].
trim
();
if
(
toSplit
.
length
===
0
)
if
(
toSplit
.
length
===
0
)
continue
;
continue
;
var
separator
=
toSplit
.
indexOf
(
":"
);
var
separator
=
toSplit
.
indexOf
(
':'
);
if
(
separator
===
-
1
)
{
if
(
separator
===
-
1
)
{
// Name but no value in the header
// Name but no value in the header
headers
[
toSplit
]
=
null
;
headers
[
toSplit
]
=
null
;
continue
;
continue
;
...
@@ -1332,20 +1454,20 @@ JQueryHttpClient.prototype.execute = function(obj) {
...
@@ -1332,20 +1454,20 @@ JQueryHttpClient.prototype.execute = function(obj) {
headers
:
headers
headers
:
headers
};
};
var
contentType
=
(
headers
[
"content-type"
]
||
headers
[
"Content-Type"
]
||
null
)
var
contentType
=
(
headers
[
'content-type'
]
||
headers
[
'Content-Type'
]
||
null
)
if
(
contentType
!=
null
)
{
if
(
contentType
!=
null
)
{
if
(
contentType
.
indexOf
(
"application/json"
)
==
0
||
contentType
.
indexOf
(
"+json"
)
>
0
)
{
if
(
contentType
.
indexOf
(
'application/json'
)
==
0
||
contentType
.
indexOf
(
'+json'
)
>
0
)
{
if
(
response
.
responseText
&&
response
.
responseText
!==
""
)
if
(
response
.
responseText
&&
response
.
responseText
!==
''
)
out
.
obj
=
JSON
.
parse
(
response
.
responseText
);
out
.
obj
=
JSON
.
parse
(
response
.
responseText
);
else
else
out
.
obj
=
{}
out
.
obj
=
{}
}
}
}
}
if
(
response
.
status
>=
200
&&
response
.
status
<
300
)
if
(
response
.
status
>=
200
&&
response
.
status
<
300
)
cb
.
response
(
out
);
cb
.
response
(
out
);
else
if
(
response
.
status
===
0
||
(
response
.
status
>=
400
&&
response
.
status
<
599
))
else
if
(
response
.
status
===
0
||
(
response
.
status
>=
400
&&
response
.
status
<
599
))
cb
.
error
(
out
);
cb
.
error
(
out
);
else
else
return
cb
.
response
(
out
);
return
cb
.
response
(
out
);
...
@@ -1353,59 +1475,57 @@ JQueryHttpClient.prototype.execute = function(obj) {
...
@@ -1353,59 +1475,57 @@ JQueryHttpClient.prototype.execute = function(obj) {
jQuery
.
support
.
cors
=
true
;
jQuery
.
support
.
cors
=
true
;
return
jQuery
.
ajax
(
obj
);
return
jQuery
.
ajax
(
obj
);
}
}
/*
/*
* ShredHttpClient is a light-weight, node or browser HTTP client
* ShredHttpClient is a light-weight, node or browser HTTP client
*/
*/
var
ShredHttpClient
=
function
(
options
)
{
var
ShredHttpClient
=
function
(
options
)
{
this
.
options
=
(
options
||
{});
this
.
options
=
(
options
||
{});
this
.
isInitialized
=
false
;
this
.
isInitialized
=
false
;
var
identity
,
toString
;
if
(
typeof
window
!==
'undefined'
)
{
if
(
typeof
window
!==
'undefined'
)
{
this
.
Shred
=
require
(
"./shred"
);
this
.
Shred
=
require
(
'./shred'
);
this
.
content
=
require
(
"./shred/content"
);
this
.
content
=
require
(
'./shred/content'
);
}
}
else
else
this
.
Shred
=
require
(
"shred"
);
this
.
Shred
=
require
(
'shred'
);
this
.
shred
=
new
this
.
Shred
();
this
.
shred
=
new
this
.
Shred
();
}
}
ShredHttpClient
.
prototype
.
initShred
=
function
()
{
ShredHttpClient
.
prototype
.
initShred
=
function
()
{
this
.
isInitialized
=
true
;
this
.
isInitialized
=
true
;
this
.
registerProcessors
(
this
.
shred
);
this
.
registerProcessors
(
this
.
shred
);
}
}
ShredHttpClient
.
prototype
.
registerProcessors
=
function
(
shred
)
{
ShredHttpClient
.
prototype
.
registerProcessors
=
function
(
)
{
var
identity
=
function
(
x
)
{
var
identity
=
function
(
x
)
{
return
x
;
return
x
;
};
};
var
toString
=
function
(
x
)
{
var
toString
=
function
(
x
)
{
return
x
.
toString
();
return
x
.
toString
();
};
};
if
(
typeof
window
!==
'undefined'
)
{
if
(
typeof
window
!==
'undefined'
)
{
this
.
content
.
registerProcessor
([
"application/json; charset=utf-8"
,
"application/json"
,
"json"
],
{
this
.
content
.
registerProcessor
([
'application/json; charset=utf-8'
,
'application/json'
,
'json'
],
{
parser
:
identity
,
parser
:
identity
,
stringify
:
toString
stringify
:
toString
});
});
}
else
{
}
else
{
this
.
Shred
.
registerProcessor
([
"application/json; charset=utf-8"
,
"application/json"
,
"json"
],
{
this
.
Shred
.
registerProcessor
([
'application/json; charset=utf-8'
,
'application/json'
,
'json'
],
{
parser
:
identity
,
parser
:
identity
,
stringify
:
toString
stringify
:
toString
});
});
}
}
}
}
ShredHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
ShredHttpClient
.
prototype
.
execute
=
function
(
obj
)
{
if
(
!
this
.
isInitialized
)
if
(
!
this
.
isInitialized
)
this
.
initShred
();
this
.
initShred
();
var
cb
=
obj
.
on
,
res
;
var
cb
=
obj
.
on
,
res
;
var
transform
=
function
(
response
)
{
var
transform
=
function
(
response
)
{
var
out
=
{
var
out
=
{
headers
:
response
.
_headers
,
headers
:
response
.
_headers
,
url
:
response
.
request
.
url
,
url
:
response
.
request
.
url
,
...
@@ -1414,12 +1534,18 @@ ShredHttpClient.prototype.execute = function(obj) {
...
@@ -1414,12 +1534,18 @@ ShredHttpClient.prototype.execute = function(obj) {
data
:
response
.
content
.
data
data
:
response
.
content
.
data
};
};
var
contentType
=
(
response
.
_headers
[
"content-type"
]
||
response
.
_headers
[
"Content-Type"
]
||
null
)
var
headers
=
response
.
_headers
.
normalized
||
response
.
_headers
;
var
contentType
=
(
headers
[
'content-type'
]
||
headers
[
'Content-Type'
]
||
null
)
if
(
contentType
!=
null
)
{
if
(
contentType
!=
null
)
{
if
(
contentType
.
indexOf
(
"application/json"
)
==
0
||
contentType
.
indexOf
(
"+json"
)
>
0
)
{
if
(
contentType
.
indexOf
(
'application/json'
)
==
0
||
contentType
.
indexOf
(
'+json'
)
>
0
)
{
if
(
response
.
content
.
data
&&
response
.
content
.
data
!==
""
)
if
(
response
.
content
.
data
&&
response
.
content
.
data
!==
''
)
try
{
out
.
obj
=
JSON
.
parse
(
response
.
content
.
data
);
out
.
obj
=
JSON
.
parse
(
response
.
content
.
data
);
}
catch
(
ex
)
{
// do not set out.obj
log
(
'unable to parse JSON content'
);
}
else
else
out
.
obj
=
{}
out
.
obj
=
{}
}
}
...
@@ -1427,20 +1553,37 @@ ShredHttpClient.prototype.execute = function(obj) {
...
@@ -1427,20 +1553,37 @@ ShredHttpClient.prototype.execute = function(obj) {
return
out
;
return
out
;
};
};
res
=
{
// Transform an error into a usable response-like object
error
:
function
(
response
)
{
var
transformError
=
function
(
error
)
{
var
out
=
{
// Default to a status of 0 - The client will treat this as a generic permissions sort of error
status
:
0
,
data
:
error
.
message
||
error
};
if
(
error
.
code
)
{
out
.
obj
=
error
;
if
(
error
.
code
===
'ENOTFOUND'
||
error
.
code
===
'ECONNREFUSED'
)
{
// We can tell the client that this should be treated as a missing resource and not as a permissions thing
out
.
status
=
404
;
}
}
return
out
;
};
var
res
=
{
error
:
function
(
response
)
{
if
(
obj
)
if
(
obj
)
return
cb
.
error
(
transform
(
response
));
return
cb
.
error
(
transform
(
response
));
},
},
redirect
:
function
(
response
)
{
// Catch the Shred error raised when the request errors as it is made (i.e. No Response is coming)
request_error
:
function
(
err
)
{
if
(
obj
)
if
(
obj
)
return
cb
.
redirect
(
transform
(
response
));
return
cb
.
error
(
transformError
(
err
));
},
},
307
:
function
(
response
)
{
response
:
function
(
response
)
{
if
(
obj
)
return
cb
.
redirect
(
transform
(
response
));
},
response
:
function
(
response
)
{
if
(
obj
)
if
(
obj
)
return
cb
.
response
(
transform
(
response
));
return
cb
.
response
(
transform
(
response
));
}
}
...
@@ -1449,30 +1592,33 @@ ShredHttpClient.prototype.execute = function(obj) {
...
@@ -1449,30 +1592,33 @@ ShredHttpClient.prototype.execute = function(obj) {
obj
.
on
=
res
;
obj
.
on
=
res
;
}
}
return
this
.
shred
.
request
(
obj
);
return
this
.
shred
.
request
(
obj
);
};
};
/**
/**
* SwaggerAuthorizations applys the correct authorization to an operation being executed
* SwaggerAuthorizations applys the correct authorization to an operation being executed
*/
*/
var
SwaggerAuthorizations
=
function
(
)
{
var
SwaggerAuthorizations
=
function
(
name
,
auth
)
{
this
.
authz
=
{};
this
.
authz
=
{};
};
if
(
name
&&
auth
)
{
this
.
authz
[
name
]
=
auth
;
}
};
SwaggerAuthorizations
.
prototype
.
add
=
function
(
name
,
auth
)
{
SwaggerAuthorizations
.
prototype
.
add
=
function
(
name
,
auth
)
{
this
.
authz
[
name
]
=
auth
;
this
.
authz
[
name
]
=
auth
;
return
auth
;
return
auth
;
};
};
SwaggerAuthorizations
.
prototype
.
remove
=
function
(
name
)
{
SwaggerAuthorizations
.
prototype
.
remove
=
function
(
name
)
{
return
delete
this
.
authz
[
name
];
return
delete
this
.
authz
[
name
];
};
};
SwaggerAuthorizations
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
SwaggerAuthorizations
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
var
status
=
null
;
var
status
=
null
;
var
key
;
var
key
,
value
,
result
;
// if the "authorizations" key is undefined, or has an empty array, add all keys
// if the "authorizations" key is undefined, or has an empty array, add all keys
if
(
typeof
authorizations
===
'undefined'
||
Object
.
keys
(
authorizations
).
length
==
0
)
{
if
(
typeof
authorizations
===
'undefined'
||
Object
.
keys
(
authorizations
).
length
==
0
)
{
for
(
key
in
this
.
authz
)
{
for
(
key
in
this
.
authz
)
{
value
=
this
.
authz
[
key
];
value
=
this
.
authz
[
key
];
result
=
value
.
apply
(
obj
,
authorizations
);
result
=
value
.
apply
(
obj
,
authorizations
);
...
@@ -1481,9 +1627,9 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
...
@@ -1481,9 +1627,9 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
}
}
}
}
else
{
else
{
for
(
name
in
authorizations
)
{
for
(
name
in
authorizations
)
{
for
(
key
in
this
.
authz
)
{
for
(
key
in
this
.
authz
)
{
if
(
key
==
name
)
{
if
(
key
==
name
)
{
value
=
this
.
authz
[
key
];
value
=
this
.
authz
[
key
];
result
=
value
.
apply
(
obj
,
authorizations
);
result
=
value
.
apply
(
obj
,
authorizations
);
if
(
result
===
true
)
if
(
result
===
true
)
...
@@ -1494,44 +1640,50 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
...
@@ -1494,44 +1640,50 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
}
}
return
status
;
return
status
;
};
};
/**
/**
* ApiKeyAuthorization allows a query param or header to be injected
* ApiKeyAuthorization allows a query param or header to be injected
*/
*/
var
ApiKeyAuthorization
=
function
(
name
,
value
,
type
)
{
var
ApiKeyAuthorization
=
function
(
name
,
value
,
type
,
delimiter
)
{
this
.
name
=
name
;
this
.
name
=
name
;
this
.
value
=
value
;
this
.
value
=
value
;
this
.
type
=
type
;
this
.
type
=
type
;
};
this
.
delimiter
=
delimiter
;
};
ApiKeyAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
ApiKeyAuthorization
.
prototype
.
apply
=
function
(
obj
)
{
if
(
this
.
type
===
"query"
)
{
if
(
this
.
type
===
'query'
)
{
if
(
obj
.
url
.
indexOf
(
'?'
)
>
0
)
if
(
obj
.
url
.
indexOf
(
'?'
)
>
0
)
obj
.
url
=
obj
.
url
+
"&"
+
this
.
name
+
"="
+
this
.
value
;
obj
.
url
=
obj
.
url
+
'&'
+
this
.
name
+
'='
+
this
.
value
;
else
else
obj
.
url
=
obj
.
url
+
"?"
+
this
.
name
+
"="
+
this
.
value
;
obj
.
url
=
obj
.
url
+
'?'
+
this
.
name
+
'='
+
this
.
value
;
return
true
;
return
true
;
}
else
if
(
this
.
type
===
"header"
)
{
}
else
if
(
this
.
type
===
'header'
)
{
if
(
typeof
obj
.
headers
[
this
.
name
]
!==
'undefined'
)
{
if
(
typeof
this
.
delimiter
!==
'undefined'
)
obj
.
headers
[
this
.
name
]
=
obj
.
headers
[
this
.
name
]
+
this
.
delimiter
+
this
.
value
;
}
else
obj
.
headers
[
this
.
name
]
=
this
.
value
;
obj
.
headers
[
this
.
name
]
=
this
.
value
;
return
true
;
return
true
;
}
}
};
};
var
CookieAuthorization
=
function
(
cookie
)
{
var
CookieAuthorization
=
function
(
cookie
)
{
this
.
cookie
=
cookie
;
this
.
cookie
=
cookie
;
}
}
CookieAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
CookieAuthorization
.
prototype
.
apply
=
function
(
obj
)
{
obj
.
cookieJar
=
obj
.
cookieJar
||
CookieJar
();
obj
.
cookieJar
=
obj
.
cookieJar
||
CookieJar
();
obj
.
cookieJar
.
setCookie
(
this
.
cookie
);
obj
.
cookieJar
.
setCookie
(
this
.
cookie
);
return
true
;
return
true
;
}
}
/**
/**
* Password Authorization is a basic auth implementation
* Password Authorization is a basic auth implementation
*/
*/
var
PasswordAuthorization
=
function
(
name
,
username
,
password
)
{
var
PasswordAuthorization
=
function
(
name
,
username
,
password
)
{
this
.
name
=
name
;
this
.
name
=
name
;
this
.
username
=
username
;
this
.
username
=
username
;
this
.
password
=
password
;
this
.
password
=
password
;
...
@@ -1539,31 +1691,35 @@ var PasswordAuthorization = function(name, username, password) {
...
@@ -1539,31 +1691,35 @@ var PasswordAuthorization = function(name, username, password) {
if
(
typeof
window
!==
'undefined'
)
if
(
typeof
window
!==
'undefined'
)
this
.
_btoa
=
btoa
;
this
.
_btoa
=
btoa
;
else
else
this
.
_btoa
=
require
(
"btoa"
);
this
.
_btoa
=
require
(
'btoa'
);
};
};
PasswordAuthorization
.
prototype
.
apply
=
function
(
obj
,
authorizations
)
{
PasswordAuthorization
.
prototype
.
apply
=
function
(
obj
)
{
var
base64encoder
=
this
.
_btoa
;
var
base64encoder
=
this
.
_btoa
;
obj
.
headers
[
"Authorization"
]
=
"Basic "
+
base64encoder
(
this
.
username
+
":"
+
this
.
password
);
obj
.
headers
[
'Authorization'
]
=
'Basic '
+
base64encoder
(
this
.
username
+
':'
+
this
.
password
);
return
true
;
return
true
;
};
};
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
var
e
=
(
typeof
window
!==
'undefined'
?
window
:
exports
);
var
sampleModels
=
{};
var
sampleModels
=
{};
var
cookies
=
{};
e
.
SampleModels
=
sampleModels
;
e
.
SampleModels
=
sampleModels
;
e
.
SwaggerHttp
=
SwaggerHttp
;
e
.
SwaggerHttp
=
SwaggerHttp
;
e
.
SwaggerRequest
=
SwaggerRequest
;
e
.
SwaggerRequest
=
SwaggerRequest
;
e
.
SwaggerAuthorizations
=
SwaggerAuthorizations
;
e
.
authorizations
=
new
SwaggerAuthorizations
();
e
.
authorizations
=
new
SwaggerAuthorizations
();
e
.
ApiKeyAuthorization
=
ApiKeyAuthorization
;
e
.
ApiKeyAuthorization
=
ApiKeyAuthorization
;
e
.
PasswordAuthorization
=
PasswordAuthorization
;
e
.
PasswordAuthorization
=
PasswordAuthorization
;
e
.
CookieAuthorization
=
CookieAuthorization
;
e
.
CookieAuthorization
=
CookieAuthorization
;
e
.
JQueryHttpClient
=
JQueryHttpClient
;
e
.
JQueryHttpClient
=
JQueryHttpClient
;
e
.
ShredHttpClient
=
ShredHttpClient
;
e
.
ShredHttpClient
=
ShredHttpClient
;
e
.
SwaggerOperation
=
SwaggerOperation
;
e
.
SwaggerOperation
=
SwaggerOperation
;
e
.
SwaggerModel
=
SwaggerModel
;
e
.
SwaggerModel
=
SwaggerModel
;
e
.
SwaggerModelProperty
=
SwaggerModelProperty
;
e
.
SwaggerModelProperty
=
SwaggerModelProperty
;
e
.
SwaggerResource
=
SwaggerResource
;
e
.
SwaggerResource
=
SwaggerResource
;
e
.
SwaggerApi
=
SwaggerApi
;
e
.
SwaggerApi
=
SwaggerApi
;
e
.
log
=
log
;
})();
code/moya-web/WebContent/swagger/swagger-ui.js
View file @
98c1144
// swagger-ui.js
// swagger-ui.js
// version 2.1.0-alpha.7
$
(
function
()
{
$
(
function
()
{
// Helper function for vertically aligning DOM elements
// Helper function for vertically aligning DOM elements
...
@@ -67,7 +68,7 @@ log = function(){
...
@@ -67,7 +68,7 @@ log = function(){
log
.
history
=
log
.
history
||
[];
log
.
history
=
log
.
history
||
[];
log
.
history
.
push
(
arguments
);
log
.
history
.
push
(
arguments
);
if
(
this
.
console
){
if
(
this
.
console
){
console
.
log
(
Array
.
prototype
.
slice
.
call
(
arguments
)
);
console
.
log
(
Array
.
prototype
.
slice
.
call
(
arguments
)
[
0
]
);
}
}
};
};
...
@@ -92,7 +93,6 @@ var Docs = {
...
@@ -92,7 +93,6 @@ var Docs = {
switch
(
fragments
.
length
)
{
switch
(
fragments
.
length
)
{
case
1
:
case
1
:
// Expand all operations for the resource and scroll to it
// Expand all operations for the resource and scroll to it
log
(
'shebang resource:'
+
fragments
[
0
]);
var
dom_id
=
'resource_'
+
fragments
[
0
];
var
dom_id
=
'resource_'
+
fragments
[
0
];
Docs
.
expandEndpointListForResource
(
fragments
[
0
]);
Docs
.
expandEndpointListForResource
(
fragments
[
0
]);
...
@@ -100,7 +100,6 @@ var Docs = {
...
@@ -100,7 +100,6 @@ var Docs = {
break
;
break
;
case
2
:
case
2
:
// Refer to the endpoint DOM element, e.g. #words_get_search
// Refer to the endpoint DOM element, e.g. #words_get_search
log
(
'shebang endpoint: '
+
fragments
.
join
(
'_'
));
// Expand Resource
// Expand Resource
Docs
.
expandEndpointListForResource
(
fragments
[
0
]);
Docs
.
expandEndpointListForResource
(
fragments
[
0
]);
...
@@ -110,8 +109,6 @@ var Docs = {
...
@@ -110,8 +109,6 @@ var Docs = {
var
li_dom_id
=
fragments
.
join
(
'_'
);
var
li_dom_id
=
fragments
.
join
(
'_'
);
var
li_content_dom_id
=
li_dom_id
+
"_content"
;
var
li_content_dom_id
=
li_dom_id
+
"_content"
;
log
(
"li_dom_id "
+
li_dom_id
);
log
(
"li_content_dom_id "
+
li_content_dom_id
);
Docs
.
expandOperation
(
$
(
'#'
+
li_content_dom_id
));
Docs
.
expandOperation
(
$
(
'#'
+
li_content_dom_id
));
$
(
'#'
+
li_dom_id
).
slideto
({
highlight
:
false
});
$
(
'#'
+
li_dom_id
).
slideto
({
highlight
:
false
});
...
@@ -188,6 +185,35 @@ var Docs = {
...
@@ -188,6 +185,35 @@ var Docs = {
}
}
};(
function
()
{
};(
function
()
{
var
template
=
Handlebars
.
template
,
templates
=
Handlebars
.
templates
=
Handlebars
.
templates
||
{};
var
template
=
Handlebars
.
template
,
templates
=
Handlebars
.
templates
=
Handlebars
.
templates
||
{};
templates
[
'apikey_button_view'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
var
buffer
=
""
,
stack1
,
functionType
=
"function"
,
escapeExpression
=
this
.
escapeExpression
;
buffer
+=
"<div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div>\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
;
if
(
stack1
=
helpers
.
keyName
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
keyName
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"</div>\n <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n"
;
return
buffer
;
});
})();
(
function
()
{
var
template
=
Handlebars
.
template
,
templates
=
Handlebars
.
templates
=
Handlebars
.
templates
||
{};
templates
[
'basic_auth_button_view'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
return
"<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n"
;
});
})();
(
function
()
{
var
template
=
Handlebars
.
template
,
templates
=
Handlebars
.
templates
=
Handlebars
.
templates
||
{};
templates
[
'content_type'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
templates
[
'content_type'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
...
@@ -234,7 +260,7 @@ function program4(depth0,data) {
...
@@ -234,7 +260,7 @@ function program4(depth0,data) {
templates
[
'main'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
templates
[
'main'
]
=
template
(
function
(
Handlebars
,
depth0
,
helpers
,
partials
,
data
)
{
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
this
.
compilerInfo
=
[
4
,
'>= 1.0.0'
];
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
helpers
=
this
.
merge
(
helpers
,
Handlebars
.
helpers
);
data
=
data
||
{};
var
buffer
=
""
,
stack1
,
functionType
=
"function"
,
escapeExpression
=
this
.
escapeExpression
,
self
=
this
;
var
buffer
=
""
,
stack1
,
stack2
,
functionType
=
"function"
,
escapeExpression
=
this
.
escapeExpression
,
self
=
this
;
function
program1
(
depth0
,
data
)
{
function
program1
(
depth0
,
data
)
{
...
@@ -269,7 +295,7 @@ function program4(depth0,data) {
...
@@ -269,7 +295,7 @@ function program4(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"<div class='info_contact'><a href=\"mailto:"
buffer
+=
"<div class='info_contact'><a href=\"mailto:"
+
escapeExpression
(((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
contact
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
escapeExpression
(((
stack1
=
((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
contact
)),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
name
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
"\">Contact the developer</a></div>"
;
+
"\">Contact the developer</a></div>"
;
return
buffer
;
return
buffer
;
}
}
...
@@ -278,9 +304,9 @@ function program6(depth0,data) {
...
@@ -278,9 +304,9 @@ function program6(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"<div class='info_license'><a href='"
buffer
+=
"<div class='info_license'><a href='"
+
escapeExpression
(((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
licenseU
rl
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
escapeExpression
(((
stack1
=
((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
license
)),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
u
rl
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
"'>"
+
"'>"
+
escapeExpression
(((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
licens
e
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
escapeExpression
(((
stack1
=
((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
license
)),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
nam
e
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
+
"</a></div>"
;
+
"</a></div>"
;
return
buffer
;
return
buffer
;
}
}
...
@@ -288,25 +314,49 @@ function program6(depth0,data) {
...
@@ -288,25 +314,49 @@ function program6(depth0,data) {
function
program8
(
depth0
,
data
)
{
function
program8
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n , <span style=\"font-variant: small-caps\">api version</span>: "
;
buffer
+=
"\n , <span style=\"font-variant: small-caps\">api version</span>: "
if
(
stack1
=
helpers
.
apiVersion
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
+
escapeExpression
(((
stack1
=
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
version
)),
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
))
else
{
stack1
=
depth0
.
apiVersion
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"\n "
;
+
"\n "
;
return
buffer
;
return
buffer
;
}
}
function
program10
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <span style=\"float:right\"><a href=\""
;
if
(
stack1
=
helpers
.
validatorUrl
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
validatorUrl
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"/debug?url="
;
if
(
stack1
=
helpers
.
url
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
url
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"\"><img id=\"validator\" src=\""
;
if
(
stack1
=
helpers
.
validatorUrl
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
validatorUrl
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"?url="
;
if
(
stack1
=
helpers
.
url
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
url
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"\"></a>\n </span>\n "
;
return
buffer
;
}
buffer
+=
"<div class='info' id='api_info'>\n "
;
buffer
+=
"<div class='info' id='api_info'>\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
info
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
info
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n</div>\n<div class='container' id='resources_container'>\n
<ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n
<h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
;
buffer
+=
"\n</div>\n<div class='container' id='resources_container'>\n
<ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n
<h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
;
if
(
stack1
=
helpers
.
basePath
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
basePath
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
basePath
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
basePath
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"\n "
;
+
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
apiVersion
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
8
,
program8
,
data
),
data
:
data
});
stack2
=
helpers
[
'if'
].
call
(
depth0
,
((
stack1
=
depth0
.
info
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
version
),
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
8
,
program8
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack2
||
stack2
===
0
)
{
buffer
+=
stack2
;
}
buffer
+=
"]</h4>\n </div>\n</div>\n"
;
buffer
+=
"]\n "
;
stack2
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
validatorUrl
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
10
,
program10
,
data
),
data
:
data
});
if
(
stack2
||
stack2
===
0
)
{
buffer
+=
stack2
;
}
buffer
+=
"\n </h4>\n </div>\n</div>\n"
;
return
buffer
;
return
buffer
;
});
});
})();
})();
...
@@ -320,31 +370,43 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -320,31 +370,43 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
function
program1
(
depth0
,
data
)
{
function
program1
(
depth0
,
data
)
{
return
"deprecated"
;
}
function
program3
(
depth0
,
data
)
{
return
"\n <h4>Warning: Deprecated</h4>\n "
;
}
function
program5
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <h4>Implementation Notes</h4>\n <p>"
;
buffer
+=
"\n <h4>Implementation Notes</h4>\n <p>"
;
if
(
stack1
=
helpers
.
notes
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
description
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
notes
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
description
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"</p>\n "
;
buffer
+=
"</p>\n "
;
return
buffer
;
return
buffer
;
}
}
function
program
3
(
depth0
,
data
)
{
function
program
7
(
depth0
,
data
)
{
return
"\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>"
;
return
"\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>"
;
}
}
function
program
5
(
depth0
,
data
)
{
function
program
9
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n "
;
buffer
+=
"\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n "
;
stack1
=
helpers
.
each
.
call
(
depth0
,
depth0
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
6
,
program6
,
data
),
data
:
data
});
stack1
=
helpers
.
each
.
call
(
depth0
,
depth0
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
10
,
program10
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n </div>\n "
;
buffer
+=
"\n </div>\n "
;
return
buffer
;
return
buffer
;
}
}
function
program
6
(
depth0
,
data
)
{
function
program
10
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
,
stack2
;
var
buffer
=
""
,
stack1
,
stack2
;
buffer
+=
"\n <div title='"
;
buffer
+=
"\n <div title='"
;
...
@@ -356,46 +418,46 @@ function program6(depth0,data) {
...
@@ -356,46 +418,46 @@ function program6(depth0,data) {
return
buffer
;
return
buffer
;
}
}
function
program
8
(
depth0
,
data
)
{
function
program
12
(
depth0
,
data
)
{
return
"</div>"
;
return
"</div>"
;
}
}
function
program1
0
(
depth0
,
data
)
{
function
program1
4
(
depth0
,
data
)
{
return
"\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n "
;
return
"\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n "
;
}
}
function
program1
2
(
depth0
,
data
)
{
function
program1
6
(
depth0
,
data
)
{
return
"\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n "
;
return
"\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n "
;
}
}
function
program1
4
(
depth0
,
data
)
{
function
program1
8
(
depth0
,
data
)
{
return
"\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n "
;
return
"\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n "
;
}
}
function
program
16
(
depth0
,
data
)
{
function
program
20
(
depth0
,
data
)
{
return
"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "
;
return
"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "
;
}
}
function
program
18
(
depth0
,
data
)
{
function
program
22
(
depth0
,
data
)
{
return
"\n "
;
return
"\n "
;
}
}
function
program2
0
(
depth0
,
data
)
{
function
program2
4
(
depth0
,
data
)
{
return
"\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <
img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' /
>\n </div>\n "
;
return
"\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <
span class='response_throbber' style='display:none'></span
>\n </div>\n "
;
}
}
buffer
+=
"\n <ul class='operations' >\n <li class='"
;
buffer
+=
"\n <ul class='operations' >\n <li class='"
;
...
@@ -430,7 +492,10 @@ function program20(depth0,data) {
...
@@ -430,7 +492,10 @@ function program20(depth0,data) {
if
(
stack1
=
helpers
.
nickname
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
nickname
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
nickname
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
nickname
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"' class=\"toggleOperation\">"
;
+
"' class=\"toggleOperation "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
deprecated
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\">"
;
if
(
stack1
=
helpers
.
path
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
path
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
path
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
path
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
...
@@ -455,40 +520,43 @@ function program20(depth0,data) {
...
@@ -455,40 +520,43 @@ function program20(depth0,data) {
else
{
stack1
=
depth0
.
nickname
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
nickname
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"_content' style='display:none'>\n "
;
+
"_content' style='display:none'>\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
notes
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
deprecated
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
3
,
program3
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
3
,
program3
,
data
),
data
:
data
};
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
description
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
7
,
program7
,
data
),
data
:
data
};
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
.
each
.
call
(
depth0
,
depth0
.
oauth
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
stack1
=
helpers
.
each
.
call
(
depth0
,
depth0
.
oauth
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
9
,
program9
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
8
,
program8
,
data
),
data
:
data
};
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
12
,
program12
,
data
),
data
:
data
};
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
0
,
program10
,
data
),
data
:
data
};
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
4
,
program14
,
data
),
data
:
data
};
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
if
(
stack1
=
helpers
.
oauth
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
oauth
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
!
helpers
.
oauth
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
type
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
2
,
program12
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
type
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
6
,
program16
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n "
;
buffer
+=
"\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
parameters
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
4
,
program14
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
parameters
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
8
,
program18
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
responseMessages
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
16
,
program16
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
responseMessages
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
20
,
program20
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
isReadOnly
,
{
hash
:{},
inverse
:
self
.
program
(
2
0
,
program20
,
data
),
fn
:
self
.
program
(
18
,
program18
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
isReadOnly
,
{
hash
:{},
inverse
:
self
.
program
(
2
4
,
program24
,
data
),
fn
:
self
.
program
(
22
,
program22
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n"
;
buffer
+=
"\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n"
;
return
buffer
;
return
buffer
;
...
@@ -526,7 +594,7 @@ function program4(depth0,data) {
...
@@ -526,7 +594,7 @@ function program4(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
7
,
program7
,
data
),
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
7
,
program7
,
data
),
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -539,8 +607,8 @@ function program5(depth0,data) {
...
@@ -539,8 +607,8 @@ function program5(depth0,data) {
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'>"
;
+
"'>"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"</textarea>\n "
;
+
"</textarea>\n "
;
return
buffer
;
return
buffer
;
...
@@ -561,7 +629,7 @@ function program9(depth0,data) {
...
@@ -561,7 +629,7 @@ function program9(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
12
,
program12
,
data
),
fn
:
self
.
program
(
10
,
program10
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
isFile
,
{
hash
:{},
inverse
:
self
.
program
(
10
,
program10
,
data
),
fn
:
self
.
program
(
2
,
program2
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -569,19 +637,28 @@ function program9(depth0,data) {
...
@@ -569,19 +637,28 @@ function program9(depth0,data) {
function
program10
(
depth0
,
data
)
{
function
program10
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
],
{
hash
:{},
inverse
:
self
.
program
(
13
,
program13
,
data
),
fn
:
self
.
program
(
11
,
program11
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
return
buffer
;
}
function
program11
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <input class='parameter' minlength='0' name='"
;
buffer
+=
"\n <input class='parameter' minlength='0' name='"
;
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"' placeholder='' type='text' value='"
;
+
"' placeholder='' type='text' value='"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'/>\n "
;
+
"'/>\n "
;
return
buffer
;
return
buffer
;
}
}
function
program1
2
(
depth0
,
data
)
{
function
program1
3
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <input class='parameter' minlength='0' name='"
;
buffer
+=
"\n <input class='parameter' minlength='0' name='"
;
...
@@ -635,7 +712,7 @@ function program5(depth0,data) {
...
@@ -635,7 +712,7 @@ function program5(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
8
,
program8
,
data
),
fn
:
self
.
program
(
6
,
program6
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
8
,
program8
,
data
),
fn
:
self
.
program
(
6
,
program6
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -753,8 +830,8 @@ function program1(depth0,data) {
...
@@ -753,8 +830,8 @@ function program1(depth0,data) {
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'>"
;
+
"'>"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"</textarea>\n "
;
+
"</textarea>\n "
;
return
buffer
;
return
buffer
;
...
@@ -764,7 +841,7 @@ function program3(depth0,data) {
...
@@ -764,7 +841,7 @@ function program3(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
6
,
program6
,
data
),
fn
:
self
.
program
(
4
,
program4
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
6
,
program6
,
data
),
fn
:
self
.
program
(
4
,
program4
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -773,8 +850,8 @@ function program4(depth0,data) {
...
@@ -773,8 +850,8 @@ function program4(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"\n "
;
+
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -821,8 +898,8 @@ function program1(depth0,data) {
...
@@ -821,8 +898,8 @@ function program1(depth0,data) {
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'>"
;
+
"'>"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"</textarea>\n "
;
+
"</textarea>\n "
;
return
buffer
;
return
buffer
;
...
@@ -832,7 +909,7 @@ function program3(depth0,data) {
...
@@ -832,7 +909,7 @@ function program3(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
6
,
program6
,
data
),
fn
:
self
.
program
(
4
,
program4
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
6
,
program6
,
data
),
fn
:
self
.
program
(
4
,
program4
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -841,8 +918,8 @@ function program4(depth0,data) {
...
@@ -841,8 +918,8 @@ function program4(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"\n "
;
+
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -905,7 +982,7 @@ function program4(depth0,data) {
...
@@ -905,7 +982,7 @@ function program4(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
7
,
program7
,
data
),
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
7
,
program7
,
data
),
fn
:
self
.
program
(
5
,
program5
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -913,13 +990,13 @@ function program4(depth0,data) {
...
@@ -913,13 +990,13 @@ function program4(depth0,data) {
function
program5
(
depth0
,
data
)
{
function
program5
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <textarea class='body-textarea' placeholder='(required)' name='"
;
buffer
+=
"\n <textarea class='body-textarea
required
' placeholder='(required)' name='"
;
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'>"
;
+
"'>"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"</textarea>\n "
;
+
"</textarea>\n "
;
return
buffer
;
return
buffer
;
...
@@ -928,7 +1005,7 @@ function program5(depth0,data) {
...
@@ -928,7 +1005,7 @@ function program5(depth0,data) {
function
program7
(
depth0
,
data
)
{
function
program7
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n <textarea class='body-textarea' placeholder='(required)' name='"
;
buffer
+=
"\n <textarea class='body-textarea
required
' placeholder='(required)' name='"
;
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
...
@@ -960,7 +1037,7 @@ function program12(depth0,data) {
...
@@ -960,7 +1037,7 @@ function program12(depth0,data) {
var
buffer
=
""
,
stack1
;
var
buffer
=
""
,
stack1
;
buffer
+=
"\n "
;
buffer
+=
"\n "
;
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
.
defaultValue
,
{
hash
:{},
inverse
:
self
.
program
(
15
,
program15
,
data
),
fn
:
self
.
program
(
13
,
program13
,
data
),
data
:
data
});
stack1
=
helpers
[
'if'
].
call
(
depth0
,
depth0
[
'default'
]
,
{
hash
:{},
inverse
:
self
.
program
(
15
,
program15
,
data
),
fn
:
self
.
program
(
13
,
program13
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n "
;
buffer
+=
"\n "
;
return
buffer
;
return
buffer
;
...
@@ -973,8 +1050,8 @@ function program13(depth0,data) {
...
@@ -973,8 +1050,8 @@ function program13(depth0,data) {
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"' placeholder='(required)' type='text' value='"
;
+
"' placeholder='(required)' type='text' value='"
;
if
(
stack1
=
helpers
.
defaultValue
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
[
'default'
]
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
defaultValue
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
[
'default'
]
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'/>\n "
;
+
"'/>\n "
;
return
buffer
;
return
buffer
;
...
@@ -1067,26 +1144,37 @@ function program1(depth0,data) {
...
@@ -1067,26 +1144,37 @@ function program1(depth0,data) {
return
" : "
;
return
" : "
;
}
}
function
program3
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"<li>\n <a href='"
;
if
(
stack1
=
helpers
.
url
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
url
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"'>Raw</a>\n </li>"
;
return
buffer
;
}
buffer
+=
"<div class='heading'>\n <h2>\n <a href='#!/"
;
buffer
+=
"<div class='heading'>\n <h2>\n <a href='#!/"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'
onclick=\"Docs.toggleEndpointListForResource('
"
;
+
"'
class=\"toggleEndpointList\" data-id=\"
"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"
');
\">"
;
+
"\">"
;
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"</a> "
;
+
"</a> "
;
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
};
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
};
if
(
stack1
=
helpers
.
description
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
if
(
stack1
=
helpers
.
summary
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
else
{
stack1
=
depth0
.
description
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
summary
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
!
helpers
.
description
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
!
helpers
.
summary
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
=
helpers
.
description
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
summary
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
description
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
summary
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
;
buffer
+=
"\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
...
@@ -1096,23 +1184,25 @@ function program1(depth0,data) {
...
@@ -1096,23 +1184,25 @@ function program1(depth0,data) {
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'
\n onclick=\"Docs.toggleEndpointListForResource('
"
;
+
"'
class=\"toggleEndpointList\" data-id=\"
"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"
');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('
"
;
+
"
\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\"
"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"
'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('
"
;
+
"
\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\"
"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
+
"'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='"
;
+
"\">\n Expand Operations\n </a>\n </li>\n "
;
if
(
stack1
=
helpers
.
url
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
options
=
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
3
,
program3
,
data
),
data
:
data
};
if
(
stack1
=
helpers
.
url
)
{
stack1
=
stack1
.
call
(
depth0
,
options
);
}
else
{
stack1
=
depth0
.
url
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
url
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
if
(
!
helpers
.
url
)
{
stack1
=
blockHelperMissing
.
call
(
depth0
,
stack1
,
options
);
}
+
"'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='"
;
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"\n </ul>\n</div>\n<ul class='endpoints' id='"
;
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
if
(
stack1
=
helpers
.
id
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
else
{
stack1
=
depth0
.
id
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
buffer
+=
escapeExpression
(
stack1
)
...
@@ -1210,7 +1300,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1210,7 +1300,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.6.3
(
function
()
{
(
function
()
{
var
ContentTypeView
,
HeaderView
,
MainView
,
OperationView
,
ParameterContentTypeView
,
ParameterView
,
ResourceView
,
ResponseContentTypeView
,
SignatureView
,
StatusCodeView
,
SwaggerUi
,
_ref
,
_ref1
,
_ref10
,
_ref2
,
_ref3
,
_ref4
,
_ref5
,
_ref6
,
_ref7
,
_ref8
,
_ref9
,
var
ApiKeyButton
,
BasicAuthButton
,
ContentTypeView
,
HeaderView
,
MainView
,
OperationView
,
ParameterContentTypeView
,
ParameterView
,
ResourceView
,
ResponseContentTypeView
,
SignatureView
,
StatusCodeView
,
SwaggerUi
,
_ref
,
_ref1
,
_ref10
,
_ref11
,
_ref12
,
_ref2
,
_ref3
,
_ref4
,
_ref5
,
_ref6
,
_ref7
,
_ref8
,
_ref9
,
__hasProp
=
{}.
hasOwnProperty
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
...
@@ -1252,7 +1342,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1252,7 +1342,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
return
_this
.
showMessage
(
d
);
return
_this
.
showMessage
(
d
);
};
};
this
.
options
.
failure
=
function
(
d
)
{
this
.
options
.
failure
=
function
(
d
)
{
if
(
_this
.
api
&&
_this
.
api
.
isValid
===
false
)
{
log
(
"not a valid 2.0 spec, loading legacy client"
);
_this
.
api
=
new
SwaggerApi
(
_this
.
options
);
return
_this
.
api
.
build
();
}
else
{
return
_this
.
onLoadFailure
(
d
);
return
_this
.
onLoadFailure
(
d
);
}
};
};
this
.
headerView
=
new
HeaderView
({
this
.
headerView
=
new
HeaderView
({
el
:
$
(
'#header'
)
el
:
$
(
'#header'
)
...
@@ -1262,6 +1358,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1262,6 +1358,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
});
});
};
};
SwaggerUi
.
prototype
.
setOption
=
function
(
option
,
value
)
{
return
this
.
options
[
option
]
=
value
;
};
SwaggerUi
.
prototype
.
getOption
=
function
(
option
)
{
return
this
.
options
[
option
];
};
SwaggerUi
.
prototype
.
updateSwaggerUi
=
function
(
data
)
{
SwaggerUi
.
prototype
.
updateSwaggerUi
=
function
(
data
)
{
this
.
options
.
url
=
data
.
url
;
this
.
options
.
url
=
data
.
url
;
return
this
.
load
();
return
this
.
load
();
...
@@ -1278,9 +1382,20 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1278,9 +1382,20 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}
}
this
.
options
.
url
=
url
;
this
.
options
.
url
=
url
;
this
.
headerView
.
update
(
url
);
this
.
headerView
.
update
(
url
);
this
.
api
=
new
SwaggerApi
(
this
.
options
);
this
.
api
=
new
SwaggerClient
(
this
.
options
);
this
.
api
.
build
();
return
this
.
api
.
build
();
return
this
.
api
;
};
SwaggerUi
.
prototype
.
collapseAll
=
function
()
{
return
Docs
.
collapseEndpointListForResource
(
''
);
};
SwaggerUi
.
prototype
.
listAll
=
function
()
{
return
Docs
.
collapseOperationsForResource
(
''
);
};
SwaggerUi
.
prototype
.
expandAll
=
function
()
{
return
Docs
.
expandOperationsForResource
(
''
);
};
};
SwaggerUi
.
prototype
.
render
=
function
()
{
SwaggerUi
.
prototype
.
render
=
function
()
{
...
@@ -1288,15 +1403,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1288,15 +1403,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
this
.
showMessage
(
'Finished Loading Resource Information. Rendering Swagger UI...'
);
this
.
showMessage
(
'Finished Loading Resource Information. Rendering Swagger UI...'
);
this
.
mainView
=
new
MainView
({
this
.
mainView
=
new
MainView
({
model
:
this
.
api
,
model
:
this
.
api
,
el
:
$
(
'#'
+
this
.
dom_id
)
el
:
$
(
'#'
+
this
.
dom_id
),
swaggerOptions
:
this
.
options
}).
render
();
}).
render
();
this
.
showMessage
();
this
.
showMessage
();
switch
(
this
.
options
.
docExpansion
)
{
switch
(
this
.
options
.
docExpansion
)
{
case
"full"
:
case
"full"
:
Docs
.
expandOperationsForResource
(
''
);
this
.
expandAll
(
);
break
;
break
;
case
"list"
:
case
"list"
:
Docs
.
collapseOperationsForResource
(
''
);
this
.
listAll
(
);
}
}
if
(
this
.
options
.
onComplete
)
{
if
(
this
.
options
.
onComplete
)
{
this
.
options
.
onComplete
(
this
.
api
,
this
);
this
.
options
.
onComplete
(
this
.
api
,
this
);
...
@@ -1421,6 +1537,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1421,6 +1537,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
})(
Backbone
.
View
);
MainView
=
(
function
(
_super
)
{
MainView
=
(
function
(
_super
)
{
var
sorters
;
__extends
(
MainView
,
_super
);
__extends
(
MainView
,
_super
);
function
MainView
()
{
function
MainView
()
{
...
@@ -1428,10 +1546,74 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1428,10 +1546,74 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
return
_ref2
;
return
_ref2
;
}
}
MainView
.
prototype
.
initialize
=
function
()
{};
sorters
=
{
'alpha'
:
function
(
a
,
b
)
{
return
a
.
path
.
localeCompare
(
b
.
path
);
},
'method'
:
function
(
a
,
b
)
{
return
a
.
method
.
localeCompare
(
b
.
method
);
}
};
MainView
.
prototype
.
initialize
=
function
(
opts
)
{
var
auth
,
key
,
name
,
url
,
value
,
_ref3
;
if
(
opts
==
null
)
{
opts
=
{};
}
this
.
model
.
auths
=
[];
_ref3
=
this
.
model
.
securityDefinitions
;
for
(
key
in
_ref3
)
{
value
=
_ref3
[
key
];
auth
=
{
name
:
key
,
type
:
value
.
type
,
value
:
value
};
this
.
model
.
auths
.
push
(
auth
);
}
if
(
this
.
model
.
info
&&
this
.
model
.
info
.
license
&&
typeof
this
.
model
.
info
.
license
===
'string'
)
{
name
=
this
.
model
.
info
.
license
;
url
=
this
.
model
.
info
.
licenseUrl
;
this
.
model
.
info
.
license
=
{};
this
.
model
.
info
.
license
.
name
=
name
;
this
.
model
.
info
.
license
.
url
=
url
;
}
if
(
!
this
.
model
.
info
)
{
this
.
model
.
info
=
{};
}
if
(
!
this
.
model
.
info
.
version
)
{
this
.
model
.
info
.
version
=
this
.
model
.
apiVersion
;
}
if
(
this
.
model
.
swaggerVersion
===
"2.0"
)
{
if
(
"validatorUrl"
in
opts
.
swaggerOptions
)
{
return
this
.
model
.
validatorUrl
=
opts
.
swaggerOptions
.
validatorUrl
;
}
else
if
(
this
.
model
.
url
.
indexOf
(
"localhost"
)
>
0
)
{
return
this
.
model
.
validatorUrl
=
null
;
}
else
{
return
this
.
model
.
validatorUrl
=
"http://online.swagger.io/validator"
;
}
}
};
MainView
.
prototype
.
render
=
function
()
{
MainView
.
prototype
.
render
=
function
()
{
var
counter
,
id
,
resource
,
resources
,
_i
,
_len
,
_ref3
;
var
auth
,
button
,
counter
,
id
,
name
,
resource
,
resources
,
_i
,
_len
,
_ref3
;
if
(
this
.
model
.
securityDefinitions
)
{
for
(
name
in
this
.
model
.
securityDefinitions
)
{
auth
=
this
.
model
.
securityDefinitions
[
name
];
if
(
auth
.
type
===
"apiKey"
&&
$
(
"#apikey_button"
).
length
===
0
)
{
button
=
new
ApiKeyButton
({
model
:
auth
}).
render
().
el
;
$
(
'.auth_main_container'
).
append
(
button
);
}
if
(
auth
.
type
===
"basicAuth"
&&
$
(
"#basic_auth_button"
).
length
===
0
)
{
button
=
new
BasicAuthButton
({
model
:
auth
}).
render
().
el
;
$
(
'.auth_main_container'
).
append
(
button
);
}
}
}
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
main
(
this
.
model
));
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
main
(
this
.
model
));
resources
=
{};
resources
=
{};
counter
=
0
;
counter
=
0
;
...
@@ -1445,18 +1627,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1445,18 +1627,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}
}
resource
.
id
=
id
;
resource
.
id
=
id
;
resources
[
id
]
=
resource
;
resources
[
id
]
=
resource
;
this
.
addResource
(
resource
);
this
.
addResource
(
resource
,
this
.
model
.
auths
);
}
}
return
this
;
return
this
;
};
};
MainView
.
prototype
.
addResource
=
function
(
resource
)
{
MainView
.
prototype
.
addResource
=
function
(
resource
,
auths
)
{
var
resourceView
;
var
resourceView
;
resource
.
id
=
resource
.
id
.
replace
(
/
\s
/g
,
'_'
);
resourceView
=
new
ResourceView
({
resourceView
=
new
ResourceView
({
model
:
resource
,
model
:
resource
,
tagName
:
'li'
,
tagName
:
'li'
,
id
:
'resource_'
+
resource
.
id
,
id
:
'resource_'
+
resource
.
id
,
className
:
'resource'
className
:
'resource'
,
auths
:
auths
,
swaggerOptions
:
this
.
options
.
swaggerOptions
});
});
return
$
(
'#resources'
).
append
(
resourceView
.
render
().
el
);
return
$
(
'#resources'
).
append
(
resourceView
.
render
().
el
);
};
};
...
@@ -1477,12 +1662,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1477,12 +1662,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
return
_ref3
;
return
_ref3
;
}
}
ResourceView
.
prototype
.
initialize
=
function
()
{};
ResourceView
.
prototype
.
initialize
=
function
(
opts
)
{
if
(
opts
==
null
)
{
opts
=
{};
}
this
.
auths
=
opts
.
auths
;
if
(
""
===
this
.
model
.
description
)
{
return
this
.
model
.
description
=
null
;
}
};
ResourceView
.
prototype
.
render
=
function
()
{
ResourceView
.
prototype
.
render
=
function
()
{
var
counter
,
id
,
methods
,
operation
,
_i
,
_len
,
_ref4
;
var
counter
,
id
,
methods
,
operation
,
_i
,
_len
,
_ref4
;
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
resource
(
this
.
model
));
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
resource
(
this
.
model
));
methods
=
{};
methods
=
{};
if
(
this
.
model
.
description
)
{
this
.
model
.
summary
=
this
.
model
.
description
;
}
_ref4
=
this
.
model
.
operationsArray
;
_ref4
=
this
.
model
.
operationsArray
;
for
(
_i
=
0
,
_len
=
_ref4
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref4
.
length
;
_i
<
_len
;
_i
++
)
{
operation
=
_ref4
[
_i
];
operation
=
_ref4
[
_i
];
...
@@ -1497,6 +1693,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1497,6 +1693,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
operation
.
parentId
=
this
.
model
.
id
;
operation
.
parentId
=
this
.
model
.
id
;
this
.
addOperation
(
operation
);
this
.
addOperation
(
operation
);
}
}
$
(
'.toggleEndpointList'
,
this
.
el
).
click
(
this
.
callDocs
.
bind
(
this
,
'toggleEndpointListForResource'
));
$
(
'.collapseResource'
,
this
.
el
).
click
(
this
.
callDocs
.
bind
(
this
,
'collapseOperationsForResource'
));
$
(
'.expandResource'
,
this
.
el
).
click
(
this
.
callDocs
.
bind
(
this
,
'expandOperationsForResource'
));
return
this
;
return
this
;
};
};
...
@@ -1506,12 +1705,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1506,12 +1705,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
operationView
=
new
OperationView
({
operationView
=
new
OperationView
({
model
:
operation
,
model
:
operation
,
tagName
:
'li'
,
tagName
:
'li'
,
className
:
'endpoint'
className
:
'endpoint'
,
swaggerOptions
:
this
.
options
.
swaggerOptions
,
auths
:
this
.
auths
});
});
$
(
'.endpoints'
,
$
(
this
.
el
)).
append
(
operationView
.
render
().
el
);
$
(
'.endpoints'
,
$
(
this
.
el
)).
append
(
operationView
.
render
().
el
);
return
this
.
number
++
;
return
this
.
number
++
;
};
};
ResourceView
.
prototype
.
callDocs
=
function
(
fnName
,
e
)
{
e
.
preventDefault
();
return
Docs
[
fnName
](
e
.
currentTarget
.
getAttribute
(
'data-id'
));
};
return
ResourceView
;
return
ResourceView
;
})(
Backbone
.
View
);
})(
Backbone
.
View
);
...
@@ -1535,13 +1741,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1535,13 +1741,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
'mouseout .api-ic'
:
'mouseExit'
'mouseout .api-ic'
:
'mouseExit'
};
};
OperationView
.
prototype
.
initialize
=
function
()
{};
OperationView
.
prototype
.
initialize
=
function
(
opts
)
{
if
(
opts
==
null
)
{
opts
=
{};
}
this
.
auths
=
opts
.
auths
;
return
this
;
};
OperationView
.
prototype
.
mouseEnter
=
function
(
e
)
{
OperationView
.
prototype
.
mouseEnter
=
function
(
e
)
{
var
elem
,
hgh
,
pos
,
scMaxX
,
scMaxY
,
scX
,
scY
,
wd
,
x
,
y
;
var
elem
,
hgh
,
pos
,
scMaxX
,
scMaxY
,
scX
,
scY
,
wd
,
x
,
y
;
elem
=
$
(
e
.
currentTarget
.
parentNode
).
find
(
'#api_information_panel'
);
elem
=
$
(
e
.
currentTarget
.
parentNode
).
find
(
'#api_information_panel'
);
x
=
e
vent
.
pageX
;
x
=
e
.
pageX
;
y
=
e
vent
.
pageY
;
y
=
e
.
pageY
;
scX
=
$
(
window
).
scrollLeft
();
scX
=
$
(
window
).
scrollLeft
();
scY
=
$
(
window
).
scrollTop
();
scY
=
$
(
window
).
scrollTop
();
scMaxX
=
scX
+
$
(
window
).
width
();
scMaxX
=
scX
+
$
(
window
).
width
();
...
@@ -1572,16 +1784,45 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1572,16 +1784,45 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
};
OperationView
.
prototype
.
render
=
function
()
{
OperationView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isMethodSubmissionSupported
,
k
,
o
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
type
,
v
,
_i
,
_j
,
_k
,
_l
,
_len
,
_len1
,
_len2
,
_len3
,
_ref5
,
_ref6
,
_ref7
,
_ref8
;
var
a
,
auth
,
auths
,
code
,
contentTypeModel
,
isMethodSubmissionSupported
,
k
,
key
,
o
,
param
,
ref
,
responseContentTypeView
,
responseSignatureView
,
schema
,
schemaObj
,
signatureModel
,
statusCode
,
type
,
v
,
value
,
_i
,
_j
,
_k
,
_l
,
_len
,
_len1
,
_len2
,
_len3
,
_len4
,
_m
,
_ref10
,
_ref11
,
_ref5
,
_ref6
,
_ref7
,
_ref8
,
_ref9
;
isMethodSubmissionSupported
=
true
;
isMethodSubmissionSupported
=
true
;
if
(
!
isMethodSubmissionSupported
)
{
if
(
!
isMethodSubmissionSupported
)
{
this
.
model
.
isReadOnly
=
true
;
this
.
model
.
isReadOnly
=
true
;
}
}
this
.
model
.
description
=
this
.
model
.
description
||
this
.
model
.
notes
;
if
(
this
.
model
.
description
)
{
this
.
model
.
description
=
this
.
model
.
description
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br />'
);
}
this
.
model
.
oauth
=
null
;
this
.
model
.
oauth
=
null
;
if
(
this
.
model
.
authorizations
)
{
if
(
this
.
model
.
authorizations
)
{
if
(
Array
.
isArray
(
this
.
model
.
authorizations
))
{
_ref5
=
this
.
model
.
authorizations
;
_ref5
=
this
.
model
.
authorizations
;
for
(
k
in
_ref5
)
{
for
(
_i
=
0
,
_len
=
_ref5
.
length
;
_i
<
_len
;
_i
++
)
{
v
=
_ref5
[
k
];
auths
=
_ref5
[
_i
];
for
(
key
in
auths
)
{
auth
=
auths
[
key
];
for
(
a
in
this
.
auths
)
{
auth
=
this
.
auths
[
a
];
if
(
auth
.
type
===
'oauth2'
)
{
this
.
model
.
oauth
=
{};
this
.
model
.
oauth
.
scopes
=
[];
_ref6
=
auth
.
value
.
scopes
;
for
(
k
in
_ref6
)
{
v
=
_ref6
[
k
];
o
=
{
scope
:
k
,
description
:
v
};
this
.
model
.
oauth
.
scopes
.
push
(
o
);
}
}
}
}
}
}
else
{
_ref7
=
this
.
model
.
authorizations
;
for
(
k
in
_ref7
)
{
v
=
_ref7
[
k
];
if
(
k
===
"oauth2"
)
{
if
(
k
===
"oauth2"
)
{
if
(
this
.
model
.
oauth
===
null
)
{
if
(
this
.
model
.
oauth
===
null
)
{
this
.
model
.
oauth
=
{};
this
.
model
.
oauth
=
{};
...
@@ -1589,13 +1830,37 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1589,13 +1830,37 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if
(
this
.
model
.
oauth
.
scopes
===
void
0
)
{
if
(
this
.
model
.
oauth
.
scopes
===
void
0
)
{
this
.
model
.
oauth
.
scopes
=
[];
this
.
model
.
oauth
.
scopes
=
[];
}
}
for
(
_i
=
0
,
_len
=
v
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_j
=
0
,
_len1
=
v
.
length
;
_j
<
_len1
;
_j
++
)
{
o
=
v
[
_i
];
o
=
v
[
_j
];
this
.
model
.
oauth
.
scopes
.
push
(
o
);
this
.
model
.
oauth
.
scopes
.
push
(
o
);
}
}
}
}
}
}
}
}
}
if
(
typeof
this
.
model
.
responses
!==
'undefined'
)
{
this
.
model
.
responseMessages
=
[];
_ref8
=
this
.
model
.
responses
;
for
(
code
in
_ref8
)
{
value
=
_ref8
[
code
];
schema
=
null
;
schemaObj
=
this
.
model
.
responses
[
code
].
schema
;
if
(
schemaObj
&&
schemaObj
[
'$ref'
])
{
schema
=
schemaObj
[
'$ref'
];
if
(
schema
.
indexOf
(
'#/definitions/'
)
===
0
)
{
schema
=
schema
.
substring
(
'#/definitions/'
.
length
);
}
}
this
.
model
.
responseMessages
.
push
({
code
:
code
,
message
:
value
.
description
,
responseModel
:
schema
});
}
}
if
(
typeof
this
.
model
.
responseMessages
===
'undefined'
)
{
this
.
model
.
responseMessages
=
[];
}
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
operation
(
this
.
model
));
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
operation
(
this
.
model
));
if
(
this
.
model
.
responseClassSignature
&&
this
.
model
.
responseClassSignature
!==
'string'
)
{
if
(
this
.
model
.
responseClassSignature
&&
this
.
model
.
responseClassSignature
!==
'string'
)
{
signatureModel
=
{
signatureModel
=
{
...
@@ -1609,6 +1874,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1609,6 +1874,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
});
});
$
(
'.model-signature'
,
$
(
this
.
el
)).
append
(
responseSignatureView
.
render
().
el
);
$
(
'.model-signature'
,
$
(
this
.
el
)).
append
(
responseSignatureView
.
render
().
el
);
}
else
{
}
else
{
this
.
model
.
responseClassSignature
=
'string'
;
$
(
'.model-signature'
,
$
(
this
.
el
)).
html
(
this
.
model
.
type
);
$
(
'.model-signature'
,
$
(
this
.
el
)).
html
(
this
.
model
.
type
);
}
}
contentTypeModel
=
{
contentTypeModel
=
{
...
@@ -1616,29 +1882,40 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1616,29 +1882,40 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
};
contentTypeModel
.
consumes
=
this
.
model
.
consumes
;
contentTypeModel
.
consumes
=
this
.
model
.
consumes
;
contentTypeModel
.
produces
=
this
.
model
.
produces
;
contentTypeModel
.
produces
=
this
.
model
.
produces
;
_ref
6
=
this
.
model
.
parameters
;
_ref
9
=
this
.
model
.
parameters
;
for
(
_
j
=
0
,
_len1
=
_ref6
.
length
;
_j
<
_len1
;
_j
++
)
{
for
(
_
k
=
0
,
_len2
=
_ref9
.
length
;
_k
<
_len2
;
_k
++
)
{
param
=
_ref
6
[
_j
];
param
=
_ref
9
[
_k
];
type
=
param
.
type
||
param
.
dataType
;
type
=
param
.
type
||
param
.
dataType
;
if
(
type
.
toLowerCase
()
===
'file'
)
{
if
(
typeof
type
===
'undefined'
)
{
schema
=
param
.
schema
;
if
(
schema
&&
schema
[
'$ref'
])
{
ref
=
schema
[
'$ref'
];
if
(
ref
.
indexOf
(
'#/definitions/'
)
===
0
)
{
type
=
ref
.
substring
(
'#/definitions/'
.
length
);
}
else
{
type
=
ref
;
}
}
}
if
(
type
&&
type
.
toLowerCase
()
===
'file'
)
{
if
(
!
contentTypeModel
.
consumes
)
{
if
(
!
contentTypeModel
.
consumes
)
{
log
(
"set content type "
);
contentTypeModel
.
consumes
=
'multipart/form-data'
;
contentTypeModel
.
consumes
=
'multipart/form-data'
;
}
}
}
}
param
.
type
=
type
;
}
}
responseContentTypeView
=
new
ResponseContentTypeView
({
responseContentTypeView
=
new
ResponseContentTypeView
({
model
:
contentTypeModel
model
:
contentTypeModel
});
});
$
(
'.response-content-type'
,
$
(
this
.
el
)).
append
(
responseContentTypeView
.
render
().
el
);
$
(
'.response-content-type'
,
$
(
this
.
el
)).
append
(
responseContentTypeView
.
render
().
el
);
_ref
7
=
this
.
model
.
parameters
;
_ref
10
=
this
.
model
.
parameters
;
for
(
_
k
=
0
,
_len2
=
_ref7
.
length
;
_k
<
_len2
;
_k
++
)
{
for
(
_
l
=
0
,
_len3
=
_ref10
.
length
;
_l
<
_len3
;
_l
++
)
{
param
=
_ref
7
[
_k
];
param
=
_ref
10
[
_l
];
this
.
addParameter
(
param
,
contentTypeModel
.
consumes
);
this
.
addParameter
(
param
,
contentTypeModel
.
consumes
);
}
}
_ref
8
=
this
.
model
.
responseMessages
;
_ref
11
=
this
.
model
.
responseMessages
;
for
(
_
l
=
0
,
_len3
=
_ref8
.
length
;
_l
<
_len3
;
_l
++
)
{
for
(
_
m
=
0
,
_len4
=
_ref11
.
length
;
_m
<
_len4
;
_m
++
)
{
statusCode
=
_ref
8
[
_l
];
statusCode
=
_ref
11
[
_m
];
this
.
addStatusCode
(
statusCode
);
this
.
addStatusCode
(
statusCode
);
}
}
return
this
;
return
this
;
...
@@ -1684,6 +1961,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1684,6 +1961,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
return
error_free
=
false
;
return
error_free
=
false
;
}
}
});
});
form
.
find
(
"textarea.required"
).
each
(
function
()
{
var
_this
=
this
;
$
(
this
).
removeClass
(
"error"
);
if
(
jQuery
.
trim
(
$
(
this
).
val
())
===
""
)
{
$
(
this
).
addClass
(
"error"
);
$
(
this
).
wiggle
({
callback
:
function
()
{
return
$
(
_this
).
focus
();
}
});
return
error_free
=
false
;
}
});
if
(
error_free
)
{
if
(
error_free
)
{
map
=
{};
map
=
{};
opts
=
{
opts
=
{
...
@@ -1704,7 +1994,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1704,7 +1994,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
for
(
_j
=
0
,
_len1
=
_ref6
.
length
;
_j
<
_len1
;
_j
++
)
{
for
(
_j
=
0
,
_len1
=
_ref6
.
length
;
_j
<
_len1
;
_j
++
)
{
o
=
_ref6
[
_j
];
o
=
_ref6
[
_j
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
"body"
]
=
o
.
value
;
map
[
o
.
name
]
=
o
.
value
;
}
}
}
}
_ref7
=
form
.
find
(
"select"
);
_ref7
=
form
.
find
(
"select"
);
...
@@ -1746,7 +2036,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1746,7 +2036,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
for
(
_j
=
0
,
_len1
=
_ref6
.
length
;
_j
<
_len1
;
_j
++
)
{
for
(
_j
=
0
,
_len1
=
_ref6
.
length
;
_j
<
_len1
;
_j
++
)
{
param
=
_ref6
[
_j
];
param
=
_ref6
[
_j
];
if
(
param
.
paramType
===
'form'
)
{
if
(
param
.
paramType
===
'form'
)
{
if
(
map
[
param
.
name
]
!==
void
0
)
{
if
(
param
.
type
.
toLowerCase
()
!==
'file'
&&
map
[
param
.
name
]
!==
void
0
)
{
bodyParam
.
append
(
param
.
name
,
map
[
param
.
name
]);
bodyParam
.
append
(
param
.
name
,
map
[
param
.
name
]);
}
}
}
}
...
@@ -1759,7 +2049,6 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1759,7 +2049,6 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
headerParams
[
param
.
name
]
=
map
[
param
.
name
];
headerParams
[
param
.
name
]
=
map
[
param
.
name
];
}
}
}
}
log
(
headerParams
);
_ref8
=
form
.
find
(
'input[type~="file"]'
);
_ref8
=
form
.
find
(
'input[type~="file"]'
);
for
(
_l
=
0
,
_len3
=
_ref8
.
length
;
_l
<
_len3
;
_l
++
)
{
for
(
_l
=
0
,
_len3
=
_ref8
.
length
;
_l
<
_len3
;
_l
++
)
{
el
=
_ref8
[
_l
];
el
=
_ref8
[
_l
];
...
@@ -1768,9 +2057,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1768,9 +2057,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
params
+=
1
;
params
+=
1
;
}
}
}
}
log
(
bodyParam
);
this
.
invocationUrl
=
this
.
model
.
supportHeaderParams
()
?
(
headerParams
=
this
.
model
.
getHeaderParams
(
map
),
delete
headerParams
[
'Content-Type'
],
this
.
model
.
urlify
(
map
,
false
))
:
this
.
model
.
urlify
(
map
,
true
);
this
.
invocationUrl
=
this
.
model
.
supportHeaderParams
()
?
(
headerParams
=
this
.
model
.
getHeaderParams
(
map
),
this
.
model
.
urlify
(
map
,
false
))
:
this
.
model
.
urlify
(
map
,
true
);
$
(
".request_url"
,
$
(
this
.
el
)).
html
(
"<pre></pre>"
);
$
(
".request_url
"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
this
.
invocationUrl
+
"</pre>"
);
$
(
".request_url
pre"
,
$
(
this
.
el
)).
text
(
this
.
invocationUrl
);
obj
=
{
obj
=
{
type
:
this
.
model
.
method
,
type
:
this
.
model
.
method
,
url
:
this
.
invocationUrl
,
url
:
this
.
invocationUrl
,
...
@@ -1834,7 +2123,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1834,7 +2123,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}
}
}
}
if
(
options
.
length
>
0
)
{
if
(
options
.
length
>
0
)
{
return
options
.
join
(
","
)
;
return
options
;
}
else
{
}
else
{
return
null
;
return
null
;
}
}
...
@@ -1937,7 +2226,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1937,7 +2226,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
};
OperationView
.
prototype
.
showStatus
=
function
(
response
)
{
OperationView
.
prototype
.
showStatus
=
function
(
response
)
{
var
code
,
content
,
contentType
,
headers
,
pre
,
response_body
,
url
;
var
code
,
content
,
contentType
,
e
,
headers
,
json
,
opts
,
pre
,
response_body
,
response_body_el
,
url
;
if
(
response
.
content
===
void
0
)
{
if
(
response
.
content
===
void
0
)
{
content
=
response
.
data
;
content
=
response
.
data
;
url
=
response
.
url
;
url
=
response
.
url
;
...
@@ -1946,18 +2235,31 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1946,18 +2235,31 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
url
=
response
.
request
.
url
;
url
=
response
.
request
.
url
;
}
}
headers
=
response
.
headers
;
headers
=
response
.
headers
;
contentType
=
headers
&&
headers
[
"Content-Type"
]
?
headers
[
"Content-Type"
].
split
(
";"
)[
0
].
trim
()
:
null
;
contentType
=
null
;
if
(
headers
)
{
contentType
=
headers
[
"Content-Type"
]
||
headers
[
"content-type"
];
if
(
contentType
)
{
contentType
=
contentType
.
split
(
";"
)[
0
].
trim
();
}
}
if
(
!
content
)
{
if
(
!
content
)
{
code
=
$
(
'<code />'
).
text
(
"no content"
);
code
=
$
(
'<code />'
).
text
(
"no content"
);
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
}
else
if
(
contentType
===
"application/json"
||
/
\+
json$/
.
test
(
contentType
))
{
}
else
if
(
contentType
===
"application/json"
||
/
\+
json$/
.
test
(
contentType
))
{
code
=
$
(
'<code />'
).
text
(
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
" "
));
json
=
null
;
try
{
json
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
" "
);
}
catch
(
_error
)
{
e
=
_error
;
json
=
"can't parse JSON. Raw result:\n\n"
+
content
;
}
code
=
$
(
'<code />'
).
text
(
json
);
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
}
else
if
(
contentType
===
"application/xml"
||
/
\+
xml$/
.
test
(
contentType
))
{
}
else
if
(
contentType
===
"application/xml"
||
/
\+
xml$/
.
test
(
contentType
))
{
code
=
$
(
'<code />'
).
text
(
this
.
formatXml
(
content
));
code
=
$
(
'<code />'
).
text
(
this
.
formatXml
(
content
));
pre
=
$
(
'<pre class="xml" />'
).
append
(
code
);
pre
=
$
(
'<pre class="xml" />'
).
append
(
code
);
}
else
if
(
contentType
===
"text/html"
)
{
}
else
if
(
contentType
===
"text/html"
)
{
code
=
$
(
'<code />'
).
html
(
content
);
code
=
$
(
'<code />'
).
html
(
_
.
escape
(
content
)
);
pre
=
$
(
'<pre class="xml" />'
).
append
(
code
);
pre
=
$
(
'<pre class="xml" />'
).
append
(
code
);
}
else
if
(
/^image
\/
/
.
test
(
contentType
))
{
}
else
if
(
/^image
\/
/
.
test
(
contentType
))
{
pre
=
$
(
'<img>'
).
attr
(
'src'
,
url
);
pre
=
$
(
'<img>'
).
attr
(
'src'
,
url
);
...
@@ -1966,19 +2268,26 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -1966,19 +2268,26 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
pre
=
$
(
'<pre class="json" />'
).
append
(
code
);
}
}
response_body
=
pre
;
response_body
=
pre
;
$
(
".request_url"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
url
+
"</pre>"
);
$
(
".request_url"
,
$
(
this
.
el
)).
html
(
"<pre></pre>"
);
$
(
".request_url pre"
,
$
(
this
.
el
)).
text
(
url
);
$
(
".response_code"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
response
.
status
+
"</pre>"
);
$
(
".response_code"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
response
.
status
+
"</pre>"
);
$
(
".response_body"
,
$
(
this
.
el
)).
html
(
response_body
);
$
(
".response_body"
,
$
(
this
.
el
)).
html
(
response_body
);
$
(
".response_headers"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
_
.
escape
(
JSON
.
stringify
(
response
.
headers
,
null
,
" "
)).
replace
(
/
\n
/g
,
"<br>"
)
+
"</pre>"
);
$
(
".response_headers"
,
$
(
this
.
el
)).
html
(
"<pre>"
+
_
.
escape
(
JSON
.
stringify
(
response
.
headers
,
null
,
" "
)).
replace
(
/
\n
/g
,
"<br>"
)
+
"</pre>"
);
$
(
".response"
,
$
(
this
.
el
)).
slideDown
();
$
(
".response"
,
$
(
this
.
el
)).
slideDown
();
$
(
".response_hider"
,
$
(
this
.
el
)).
show
();
$
(
".response_hider"
,
$
(
this
.
el
)).
show
();
$
(
".response_throbber"
,
$
(
this
.
el
)).
hide
();
$
(
".response_throbber"
,
$
(
this
.
el
)).
hide
();
return
hljs
.
highlightBlock
(
$
(
'.response_body'
,
$
(
this
.
el
))[
0
]);
response_body_el
=
$
(
'.response_body'
,
$
(
this
.
el
))[
0
];
opts
=
this
.
options
.
swaggerOptions
;
if
(
opts
.
highlightSizeThreshold
&&
response
.
data
.
length
>
opts
.
highlightSizeThreshold
)
{
return
response_body_el
;
}
else
{
return
hljs
.
highlightBlock
(
response_body_el
);
}
};
};
OperationView
.
prototype
.
toggleOperationContent
=
function
()
{
OperationView
.
prototype
.
toggleOperationContent
=
function
()
{
var
elem
;
var
elem
;
elem
=
$
(
'#'
+
Docs
.
escapeResourceName
(
this
.
model
.
parentId
)
+
"_"
+
this
.
model
.
nickname
+
"_content"
);
elem
=
$
(
'#'
+
Docs
.
escapeResourceName
(
this
.
model
.
parentId
+
"_"
+
this
.
model
.
nickname
+
"_content"
)
);
if
(
elem
.
is
(
':visible'
))
{
if
(
elem
.
is
(
':visible'
))
{
return
Docs
.
collapseOperation
(
elem
);
return
Docs
.
collapseOperation
(
elem
);
}
else
{
}
else
{
...
@@ -2048,14 +2357,31 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -2048,14 +2357,31 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
};
ParameterView
.
prototype
.
render
=
function
()
{
ParameterView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isParam
,
parameterContentTypeView
,
re
sponseContentTypeView
,
signatureModel
,
signatureView
,
template
,
type
;
var
contentTypeModel
,
isParam
,
parameterContentTypeView
,
re
f
,
responseContentTypeView
,
schema
,
signatureModel
,
signatureView
,
template
,
type
;
type
=
this
.
model
.
type
||
this
.
model
.
dataType
;
type
=
this
.
model
.
type
||
this
.
model
.
dataType
;
if
(
typeof
type
===
'undefined'
)
{
schema
=
this
.
model
.
schema
;
if
(
schema
&&
schema
[
'$ref'
])
{
ref
=
schema
[
'$ref'
];
if
(
ref
.
indexOf
(
'#/definitions/'
)
===
0
)
{
type
=
ref
.
substring
(
'#/definitions/'
.
length
);
}
else
{
type
=
ref
;
}
}
}
this
.
model
.
type
=
type
;
this
.
model
.
paramType
=
this
.
model
[
"in"
]
||
this
.
model
.
paramType
;
if
(
this
.
model
.
paramType
===
'body'
)
{
if
(
this
.
model
.
paramType
===
'body'
)
{
this
.
model
.
isBody
=
true
;
this
.
model
.
isBody
=
true
;
}
}
if
(
type
.
toLowerCase
()
===
'file'
)
{
if
(
type
&&
type
.
toLowerCase
()
===
'file'
)
{
this
.
model
.
isFile
=
true
;
this
.
model
.
isFile
=
true
;
}
}
this
.
model
[
"default"
]
=
this
.
model
[
"default"
]
||
this
.
model
.
defaultValue
;
if
(
this
.
model
.
allowableValues
)
{
this
.
model
.
isList
=
true
;
}
template
=
this
.
template
();
template
=
this
.
template
();
$
(
this
.
el
).
html
(
template
(
this
.
model
));
$
(
this
.
el
).
html
(
template
(
this
.
model
));
signatureModel
=
{
signatureModel
=
{
...
@@ -2265,4 +2591,107 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
...
@@ -2265,4 +2591,107 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
})(
Backbone
.
View
);
ApiKeyButton
=
(
function
(
_super
)
{
__extends
(
ApiKeyButton
,
_super
);
function
ApiKeyButton
()
{
_ref11
=
ApiKeyButton
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref11
;
}
ApiKeyButton
.
prototype
.
initialize
=
function
()
{};
ApiKeyButton
.
prototype
.
render
=
function
()
{
var
template
;
template
=
this
.
template
();
$
(
this
.
el
).
html
(
template
(
this
.
model
));
return
this
;
};
ApiKeyButton
.
prototype
.
events
=
{
"click #apikey_button"
:
"toggleApiKeyContainer"
,
"click #apply_api_key"
:
"applyApiKey"
};
ApiKeyButton
.
prototype
.
applyApiKey
=
function
()
{
var
elem
;
window
.
authorizations
.
add
(
this
.
model
.
name
,
new
ApiKeyAuthorization
(
this
.
model
.
name
,
$
(
"#input_apiKey_entry"
).
val
(),
this
.
model
[
"in"
]));
window
.
swaggerUi
.
load
();
return
elem
=
$
(
'#apikey_container'
).
show
();
};
ApiKeyButton
.
prototype
.
toggleApiKeyContainer
=
function
()
{
var
elem
;
if
(
$
(
'#apikey_container'
).
length
>
0
)
{
elem
=
$
(
'#apikey_container'
).
first
();
if
(
elem
.
is
(
':visible'
))
{
return
elem
.
hide
();
}
else
{
$
(
'.auth_container'
).
hide
();
return
elem
.
show
();
}
}
};
ApiKeyButton
.
prototype
.
template
=
function
()
{
return
Handlebars
.
templates
.
apikey_button_view
;
};
return
ApiKeyButton
;
})(
Backbone
.
View
);
BasicAuthButton
=
(
function
(
_super
)
{
__extends
(
BasicAuthButton
,
_super
);
function
BasicAuthButton
()
{
_ref12
=
BasicAuthButton
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref12
;
}
BasicAuthButton
.
prototype
.
initialize
=
function
()
{};
BasicAuthButton
.
prototype
.
render
=
function
()
{
var
template
;
template
=
this
.
template
();
$
(
this
.
el
).
html
(
template
(
this
.
model
));
return
this
;
};
BasicAuthButton
.
prototype
.
events
=
{
"click #basic_auth_button"
:
"togglePasswordContainer"
,
"click #apply_basic_auth"
:
"applyPassword"
};
BasicAuthButton
.
prototype
.
applyPassword
=
function
()
{
var
elem
,
password
,
username
;
console
.
log
(
"applying password"
);
username
=
$
(
".input_username"
).
val
();
password
=
$
(
".input_password"
).
val
();
window
.
authorizations
.
add
(
this
.
model
.
type
,
new
PasswordAuthorization
(
"basic"
,
username
,
password
));
window
.
swaggerUi
.
load
();
return
elem
=
$
(
'#basic_auth_container'
).
hide
();
};
BasicAuthButton
.
prototype
.
togglePasswordContainer
=
function
()
{
var
elem
;
if
(
$
(
'#basic_auth_container'
).
length
>
0
)
{
elem
=
$
(
'#basic_auth_container'
).
show
();
if
(
elem
.
is
(
':visible'
))
{
return
elem
.
slideUp
();
}
else
{
$
(
'.auth_container'
).
hide
();
return
elem
.
show
();
}
}
};
BasicAuthButton
.
prototype
.
template
=
function
()
{
return
Handlebars
.
templates
.
basic_auth_button_view
;
};
return
BasicAuthButton
;
})(
Backbone
.
View
);
}).
call
(
this
);
}).
call
(
this
);
code/moya-web/WebContent/swagger/swagger-ui.min.js
View file @
98c1144
This diff could not be displayed because it is too large.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment