Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ihor Kaharlichenko
swagger-ui-oms
Commits
888db09f
Commit
888db09f
authored
Aug 14, 2013
by
Tony Tam
Browse files
fixed enum, required flags
parent
f29d53d5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
dist/lib/swagger.js
View file @
888db09f
...
...
@@ -385,10 +385,17 @@
SwaggerModel
=
(
function
()
{
function
SwaggerModel
(
modelName
,
obj
)
{
var
propertyName
;
var
propertyName
,
value
;
this
.
name
=
obj
.
id
!=
null
?
obj
.
id
:
modelName
;
this
.
properties
=
[];
for
(
propertyName
in
obj
.
properties
)
{
if
(
obj
[
"
enum
"
]
!=
null
)
{
for
(
value
in
obj
[
"
enum
"
])
{
if
(
propertyName
===
value
)
{
obj
.
properties
[
propertyName
].
required
=
true
;
}
}
}
this
.
properties
.
push
(
new
SwaggerModelProperty
(
propertyName
,
obj
.
properties
[
propertyName
]));
}
}
...
...
@@ -464,6 +471,7 @@
this
.
isCollection
=
this
.
dataType
&&
(
this
.
dataType
.
toLowerCase
()
===
'
array
'
||
this
.
dataType
.
toLowerCase
()
===
'
list
'
||
this
.
dataType
.
toLowerCase
()
===
'
set
'
);
this
.
descr
=
obj
.
description
;
this
.
required
=
obj
.
required
;
console
.
log
(
this
);
if
(
obj
.
items
!=
null
)
{
if
(
obj
.
items
.
type
!=
null
)
{
this
.
refDataType
=
obj
.
items
.
type
;
...
...
@@ -524,7 +532,7 @@
SwaggerOperation
=
(
function
()
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
type
,
responseMessages
,
resource
,
consumes
,
produces
)
{
var
parameter
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
var
parameter
,
v
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
,
_ref3
,
_this
=
this
;
this
.
nickname
=
nickname
;
this
.
path
=
path
;
...
...
@@ -572,6 +580,26 @@
}
parameter
.
signature
=
this
.
getSignature
(
type
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
type
,
this
.
resource
.
models
);
if
(
parameter
[
"
enum
"
]
!=
null
)
{
parameter
.
isList
=
true
;
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
.
descriptiveValues
=
[];
_ref2
=
parameter
[
"
enum
"
];
for
(
_j
=
0
,
_len1
=
_ref2
.
length
;
_j
<
_len1
;
_j
++
)
{
v
=
_ref2
[
_j
];
if
((
parameter
.
defaultValue
!=
null
)
&&
parameter
.
defaultValue
===
v
)
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
isDefault
:
true
});
}
else
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
isDefault
:
false
});
}
}
}
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
parameter
.
isRange
=
true
;
...
...
@@ -580,9 +608,9 @@
}
if
(
parameter
.
allowableValues
.
values
!=
null
)
{
parameter
.
allowableValues
.
descriptiveValues
=
[];
_ref
2
=
parameter
.
allowableValues
.
values
;
for
(
_
j
=
0
,
_len
1
=
_ref
2
.
length
;
_
j
<
_len
1
;
_
j
++
)
{
v
=
_ref
2
[
_
j
];
_ref
3
=
parameter
.
allowableValues
.
values
;
for
(
_
k
=
0
,
_len
2
=
_ref
3
.
length
;
_
k
<
_len
2
;
_
k
++
)
{
v
=
_ref
3
[
_
k
];
if
((
parameter
.
defaultValue
!=
null
)
&&
parameter
.
defaultValue
===
v
)
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
...
...
dist/swagger-ui.js
View file @
888db09f
...
...
@@ -317,45 +317,45 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
function
program1
(
depth0
,
data
)
{
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
});
}
else
{
stack1
=
depth0
.
notes
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
</p>
\n
"
;
buffer
+=
"
</p>
\n
"
;
return
buffer
;
}
function
program3
(
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
program5
(
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
program7
(
depth0
,
data
)
{
return
"
\n
<div style='margin:0;padding:0;display:inline'></div>
\n
<h4>Error Status Codes</h4>
\n
<table class='fullwidth'>
\n
<thead>
\n
<tr>
\n
<th>HTTP Status Code</th>
\n
<th>Reason</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>Error Status Codes</h4>
\n
<table class='fullwidth'>
\n
<thead>
\n
<tr>
\n
<th>HTTP Status Code</th>
\n
<th>Reason</th>
\n
</tr>
\n
</thead>
\n
<tbody class=
\"
operation-status
\"
>
\n
\n
</tbody>
\n
</table>
\n
"
;
}
function
program9
(
depth0
,
data
)
{
return
"
\n
"
;
return
"
\n
"
;
}
function
program11
(
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
<img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />
\n
</div>
\n
"
;
}
buffer
+=
"
\n
<ul class='operations' >
\n
<li class='
"
;
buffer
+=
"
\n
<ul class='operations' >
\n
<li class='
"
;
if
(
stack1
=
helpers
.
method
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
method
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -375,7 +375,7 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
number
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
number
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
'>
\n
<div class='heading'>
\n
<h3>
\n
<span class='http_method'>
\n
<a href='#!/
"
;
+
"
'>
\n
<div class='heading'>
\n
<h3>
\n
<span class='http_method'>
\n
<a href='#!/
"
;
if
(
stack1
=
helpers
.
resourceName
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
resourceName
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -395,7 +395,7 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
method
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
method
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
</a>
\n
</span>
\n
<span class='path'>
\n
<a href='#!/
"
;
+
"
</a>
\n
</span>
\n
<span class='path'>
\n
<a href='#!/
"
;
if
(
stack1
=
helpers
.
resourceName
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
resourceName
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -415,7 +415,7 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
path
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
path
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
</a>
\n
</span>
\n
</h3>
\n
<ul class='options'>
\n
<li>
\n
<a href='#!/
"
;
+
"
</a>
\n
</span>
\n
</h3>
\n
<ul class='options'>
\n
<li>
\n
<a href='#!/
"
;
if
(
stack1
=
helpers
.
resourceName
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
resourceName
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -435,7 +435,7 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
summary
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
summary
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
</a>
\n
</li>
\n
</ul>
\n
</div>
\n
<div class='content' id='
"
;
buffer
+=
"
</a>
\n
</li>
\n
</ul>
\n
</div>
\n
<div class='content' id='
"
;
if
(
stack1
=
helpers
.
resourceName
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
resourceName
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -451,22 +451,22 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
number
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
number
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
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
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
stack1
=
helpers
[
'
if
'
].
call
(
depth0
,
depth0
.
type
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
3
,
program3
,
data
),
data
:
data
});
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
(
5
,
program5
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
stack1
=
helpers
[
'
if
'
].
call
(
depth0
,
depth0
.
errorResponses
,
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
7
,
program7
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
stack1
=
helpers
[
'
if
'
].
call
(
depth0
,
depth0
.
isReadOnly
,
{
hash
:{},
inverse
:
self
.
program
(
11
,
program11
,
data
),
fn
:
self
.
program
(
9
,
program9
,
data
),
data
:
data
});
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
;
});
})();
...
...
@@ -598,43 +598,43 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
function
program1
(
depth0
,
data
)
{
return
"
\n
"
;
return
"
\n
"
;
}
function
program3
(
depth0
,
data
)
{
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
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
return
buffer
;
}
function
program4
(
depth0
,
data
)
{
return
"
\n
"
;
return
"
\n
"
;
}
function
program6
(
depth0
,
data
)
{
return
"
\n
<option selected=
\"\"
value=''></option>
\n
"
;
return
"
\n
<option selected=
\"\"
value=''></option>
\n
"
;
}
function
program8
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
stack1
=
helpers
[
'
if
'
].
call
(
depth0
,
depth0
.
isDefault
,
{
hash
:{},
inverse
:
self
.
program
(
11
,
program11
,
data
),
fn
:
self
.
program
(
9
,
program9
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
return
buffer
;
}
function
program9
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"
\n
<option value='
"
;
buffer
+=
"
\n
<option value='
"
;
if
(
stack1
=
helpers
.
value
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
value
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -642,14 +642,14 @@ function program9(depth0,data) {
if
(
stack1
=
helpers
.
value
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
value
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
(default)</option>
\n
"
;
+
"
(default)</option>
\n
"
;
return
buffer
;
}
function
program11
(
depth0
,
data
)
{
var
buffer
=
""
,
stack1
;
buffer
+=
"
\n
<option value='
"
;
buffer
+=
"
\n
<option value='
"
;
if
(
stack1
=
helpers
.
value
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
value
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
...
...
@@ -657,7 +657,7 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
value
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
value
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
</option>
\n
"
;
+
"
</option>
\n
"
;
return
buffer
;
}
...
...
@@ -665,17 +665,17 @@ function program11(depth0,data) {
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
</td>
\n
<td>
\n
<select class='parameter' name='
"
;
+
"
</td>
\n
<td>
\n
<select class='parameter' name='
"
;
if
(
stack1
=
helpers
.
name
)
{
stack1
=
stack1
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack1
=
depth0
.
name
;
stack1
=
typeof
stack1
===
functionType
?
stack1
.
apply
(
depth0
)
:
stack1
;
}
buffer
+=
escapeExpression
(
stack1
)
+
"
'>
\n
"
;
+
"
'>
\n
"
;
stack1
=
helpers
[
'
if
'
].
call
(
depth0
,
depth0
.
required
,
{
hash
:{},
inverse
:
self
.
program
(
3
,
program3
,
data
),
fn
:
self
.
program
(
1
,
program1
,
data
),
data
:
data
});
if
(
stack1
||
stack1
===
0
)
{
buffer
+=
stack1
;
}
buffer
+=
"
\n
"
;
buffer
+=
"
\n
"
;
stack2
=
helpers
.
each
.
call
(
depth0
,
((
stack1
=
depth0
.
allowableValues
),
stack1
==
null
||
stack1
===
false
?
stack1
:
stack1
.
descriptiveValues
),
{
hash
:{},
inverse
:
self
.
noop
,
fn
:
self
.
program
(
8
,
program8
,
data
),
data
:
data
});
if
(
stack2
||
stack2
===
0
)
{
buffer
+=
stack2
;
}
buffer
+=
"
\n
</select>
\n
</td>
\n
<td>
"
;
buffer
+=
"
\n
</select>
\n
</td>
\n
<td>
"
;
if
(
stack2
=
helpers
.
description
)
{
stack2
=
stack2
.
call
(
depth0
,
{
hash
:{},
data
:
data
});
}
else
{
stack2
=
depth0
.
description
;
stack2
=
typeof
stack2
===
functionType
?
stack2
.
apply
(
depth0
)
:
stack2
;
}
if
(
stack2
||
stack2
===
0
)
{
buffer
+=
stack2
;
}
...
...
@@ -1515,7 +1515,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView
.
prototype
.
submitOperation
=
function
(
e
)
{
var
error_free
,
form
,
map
,
o
,
opts
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
;
var
error_free
,
form
,
map
,
o
,
opts
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
;
if
(
e
!=
null
)
{
e
.
preventDefault
();
}
...
...
@@ -1553,6 +1553,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
map
[
"
body
"
]
=
o
.
value
;
}
}
_ref2
=
form
.
find
(
"
select
"
);
for
(
_k
=
0
,
_len2
=
_ref2
.
length
;
_k
<
_len2
;
_k
++
)
{
o
=
_ref2
[
_k
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
o
.
name
]
=
o
.
value
;
}
}
opts
.
responseContentType
=
$
(
"
div select[name=responseContentType]
"
,
$
(
this
.
el
)).
val
();
opts
.
requestContentType
=
$
(
"
div select[name=parameterContentType]
"
,
$
(
this
.
el
)).
val
();
return
this
.
model
[
"
do
"
](
map
,
opts
,
this
.
showCompleteStatus
,
this
.
showErrorStatus
,
this
);
...
...
dist/swagger-ui.min.js
View file @
888db09f
This diff is collapsed.
Click to expand it.
lib/swagger.js
View file @
888db09f
...
...
@@ -385,10 +385,17 @@
SwaggerModel
=
(
function
()
{
function
SwaggerModel
(
modelName
,
obj
)
{
var
propertyName
;
var
propertyName
,
value
;
this
.
name
=
obj
.
id
!=
null
?
obj
.
id
:
modelName
;
this
.
properties
=
[];
for
(
propertyName
in
obj
.
properties
)
{
if
(
obj
[
"
enum
"
]
!=
null
)
{
for
(
value
in
obj
[
"
enum
"
])
{
if
(
propertyName
===
value
)
{
obj
.
properties
[
propertyName
].
required
=
true
;
}
}
}
this
.
properties
.
push
(
new
SwaggerModelProperty
(
propertyName
,
obj
.
properties
[
propertyName
]));
}
}
...
...
@@ -464,6 +471,7 @@
this
.
isCollection
=
this
.
dataType
&&
(
this
.
dataType
.
toLowerCase
()
===
'
array
'
||
this
.
dataType
.
toLowerCase
()
===
'
list
'
||
this
.
dataType
.
toLowerCase
()
===
'
set
'
);
this
.
descr
=
obj
.
description
;
this
.
required
=
obj
.
required
;
console
.
log
(
this
);
if
(
obj
.
items
!=
null
)
{
if
(
obj
.
items
.
type
!=
null
)
{
this
.
refDataType
=
obj
.
items
.
type
;
...
...
@@ -524,7 +532,7 @@
SwaggerOperation
=
(
function
()
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
type
,
responseMessages
,
resource
,
consumes
,
produces
)
{
var
parameter
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
var
parameter
,
v
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
,
_ref3
,
_this
=
this
;
this
.
nickname
=
nickname
;
this
.
path
=
path
;
...
...
@@ -572,6 +580,26 @@
}
parameter
.
signature
=
this
.
getSignature
(
type
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
type
,
this
.
resource
.
models
);
if
(
parameter
[
"
enum
"
]
!=
null
)
{
parameter
.
isList
=
true
;
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
.
descriptiveValues
=
[];
_ref2
=
parameter
[
"
enum
"
];
for
(
_j
=
0
,
_len1
=
_ref2
.
length
;
_j
<
_len1
;
_j
++
)
{
v
=
_ref2
[
_j
];
if
((
parameter
.
defaultValue
!=
null
)
&&
parameter
.
defaultValue
===
v
)
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
isDefault
:
true
});
}
else
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
isDefault
:
false
});
}
}
}
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
parameter
.
isRange
=
true
;
...
...
@@ -580,9 +608,9 @@
}
if
(
parameter
.
allowableValues
.
values
!=
null
)
{
parameter
.
allowableValues
.
descriptiveValues
=
[];
_ref
2
=
parameter
.
allowableValues
.
values
;
for
(
_
j
=
0
,
_len
1
=
_ref
2
.
length
;
_
j
<
_len
1
;
_
j
++
)
{
v
=
_ref
2
[
_
j
];
_ref
3
=
parameter
.
allowableValues
.
values
;
for
(
_
k
=
0
,
_len
2
=
_ref
3
.
length
;
_
k
<
_len
2
;
_
k
++
)
{
v
=
_ref
3
[
_
k
];
if
((
parameter
.
defaultValue
!=
null
)
&&
parameter
.
defaultValue
===
v
)
{
parameter
.
allowableValues
.
descriptiveValues
.
push
({
value
:
v
,
...
...
src/main/coffeescript/view/OperationView.coffee
View file @
888db09f
...
...
@@ -89,6 +89,10 @@ class OperationView extends Backbone.View
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
map
[
"body"
]
=
o
.
value
for
o
in
form
.
find
(
"select"
)
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
map
[
o
.
name
]
=
o
.
value
opts
.
responseContentType
=
$
(
"div select[name=responseContentType]"
,
$
(
@
el
)).
val
()
opts
.
requestContentType
=
$
(
"div select[name=parameterContentType]"
,
$
(
@
el
)).
val
()
...
...
src/main/template/operation.handlebars
View file @
888db09f
<ul
class=
'operations'
>
<li
class=
'
{{
method
}}
operation'
id=
'
{{
resourceName
}}
_
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
>
<div
class=
'heading'
>
<h3>
<span
class=
'http_method'
>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{
method
}}
</a>
</span>
<span
class=
'path'
>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{
path
}}
</a>
</span>
</h3>
<ul
class=
'options'
>
<li>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{{
summary
}}}
</a>
</li>
</ul>
</div>
<div
class=
'content'
id=
'
{{
resourceName
}}
_
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
_content'
style=
'display:none'
>
{{#if
notes
}}
<h4>
Implementation Notes
</h4>
<p>
{{{
notes
}}}
</p>
{{/if}}
{{#if
type
}}
<h4>
Response Class
</h4>
<p><span
class=
"model-signature"
/></p>
<br/>
<div
class=
"response-content-type"
/>
{{/if}}
<form
accept-charset=
'UTF-8'
class=
'sandbox'
>
<div
style=
'margin:0;padding:0;display:inline'
></div>
{{#if
parameters
}}
<h4>
Parameters
</h4>
<table
class=
'fullwidth'
>
<thead>
<tr>
<th
style=
"width: 100px; max-width: 100px"
>
Parameter
</th>
<th
style=
"width: 310px; max-width: 310px"
>
Value
</th>
<th
style=
"width: 200px; max-width: 200px"
>
Description
</th>
<th
style=
"width: 100px; max-width: 100px"
>
Parameter Type
</th>
<th
style=
"width: 220px; max-width: 230px"
>
Data Type
</th>
</tr>
</thead>
<tbody
class=
"operation-params"
>
<ul
class=
'operations'
>
<li
class=
'
{{
method
}}
operation'
id=
'
{{
resourceName
}}
_
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
>
<div
class=
'heading'
>
<h3>
<span
class=
'http_method'
>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{
method
}}
</a>
</span>
<span
class=
'path'
>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{
path
}}
</a>
</span>
</h3>
<ul
class=
'options'
>
<li>
<a
href=
'#!/
{{
resourceName
}}
/
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
'
class=
"toggleOperation"
>
{{{
summary
}}}
</a>
</li>
</ul>
</div>
<div
class=
'content'
id=
'
{{
resourceName
}}
_
{{
nickname
}}
_
{{
method
}}
_
{{
number
}}
_content'
style=
'display:none'
>
{{#if
notes
}}
<h4>
Implementation Notes
</h4>
<p>
{{{
notes
}}}
</p>
{{/if}}
{{#if
type
}}
<h4>
Response Class
</h4>
<p><span
class=
"model-signature"
/></p>
<br/>
<div
class=
"response-content-type"
/>
{{/if}}
<form
accept-charset=
'UTF-8'
class=
'sandbox'
>
<div
style=
'margin:0;padding:0;display:inline'
></div>
{{#if
parameters
}}
<h4>
Parameters
</h4>
<table
class=
'fullwidth'
>
<thead>
<tr>
<th
style=
"width: 100px; max-width: 100px"
>
Parameter
</th>
<th
style=
"width: 310px; max-width: 310px"
>
Value
</th>
<th
style=
"width: 200px; max-width: 200px"
>
Description
</th>
<th
style=
"width: 100px; max-width: 100px"
>
Parameter Type
</th>
<th
style=
"width: 220px; max-width: 230px"
>
Data Type
</th>
</tr>
</thead>
<tbody
class=
"operation-params"
>
</tbody>
</table>
{{/if}}
{{#if
errorResponses
}}
<div
style=
'margin:0;padding:0;display:inline'
></div>
<h4>
Error Status Codes
</h4>
<table
class=
'fullwidth'
>
<thead>
<tr>
<th>
HTTP Status Code
</th>
<th>
Reason
</th>
</tr>
</thead>
<tbody
class=
"operation-status"
>
</tbody>
</table>
{{/if}}
{{#if
isReadOnly
}}
{{else}}
<div
class=
'sandbox_header'
>
<input
class=
'submit'
name=
'commit'
type=
'button'
value=
'Try it out!'
/>
<a
href=
'#'
class=
'response_hider'
style=
'display:none'
>
Hide Response
</a>
<img
alt=
'Throbber'
class=
'response_throbber'
src=
'images/throbber.gif'
style=
'display:none'
/>
</div>
{{/if}}
</form>
<div
class=
'response'
style=
'display:none'
>
<h4>
Request URL
</h4>
<div
class=
'block request_url'
></div>
<h4>
Response Body
</h4>
<div
class=
'block response_body'
></div>
<h4>
Response Code
</h4>
<div
class=
'block response_code'
></div>
<h4>
Response Headers
</h4>
<div
class=
'block response_headers'
></div>
</div>
</div>
</li>
</ul>
</tbody>
</table>
{{/if}}
{{#if
errorResponses
}}
<div
style=
'margin:0;padding:0;display:inline'
></div>
<h4>
Error Status Codes
</h4>
<table
class=
'fullwidth'
>
<thead>
<tr>
<th>
HTTP Status Code
</th>
<th>
Reason
</th>
</tr>
</thead>
<tbody
class=
"operation-status"
>
</tbody>
</table>
{{/if}}
{{#if
isReadOnly
}}
{{else}}
<div
class=
'sandbox_header'
>
<input
class=
'submit'
name=
'commit'
type=
'button'
value=
'Try it out!'
/>
<a
href=
'#'
class=
'response_hider'
style=
'display:none'
>
Hide Response
</a>
<img
alt=
'Throbber'
class=
'response_throbber'
src=
'images/throbber.gif'
style=
'display:none'
/>
</div>
{{/if}}
</form>
<div
class=
'response'
style=
'display:none'
>
<h4>
Request URL
</h4>
<div
class=
'block request_url'
></div>
<h4>
Response Body
</h4>
<div
class=
'block response_body'
></div>
<h4>
Response Code
</h4>
<div
class=
'block response_code'
></div>
<h4>
Response Headers
</h4>
<div
class=
'block response_headers'
></div>
</div>
</div>
</li>
</ul>