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
4b5e4e5d
Commit
4b5e4e5d
authored
Aug 12, 2013
by
Tony Tam
Browse files
updated for 1.2 support
parent
b2637fc4
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
dist/lib/swagger.js
View file @
4b5e4e5d
...
@@ -49,7 +49,6 @@
...
@@ -49,7 +49,6 @@
var
e
,
obj
,
var
e
,
obj
,
_this
=
this
;
_this
=
this
;
this
.
progress
(
'
fetching resource list:
'
+
this
.
url
);
this
.
progress
(
'
fetching resource list:
'
+
this
.
url
);
console
.
log
(
'
getting
'
+
this
.
url
);
obj
=
{
obj
=
{
url
:
this
.
url
,
url
:
this
.
url
,
method
:
"
get
"
,
method
:
"
get
"
,
...
@@ -387,13 +386,14 @@
...
@@ -387,13 +386,14 @@
}
}
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
var
prop
,
_i
,
_len
,
_ref
,
_results
;
var
prop
,
type
,
_i
,
_len
,
_ref
,
_results
;
_ref
=
this
.
properties
;
_ref
=
this
.
properties
;
_results
=
[];
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
prop
=
_ref
[
_i
];
prop
=
_ref
[
_i
];
if
(
allModels
[
prop
.
dataType
]
!=
null
)
{
type
=
prop
.
type
||
prop
.
dataType
;
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
dataType
]);
if
(
allModels
[
type
]
!=
null
)
{
_results
.
push
(
prop
.
refModel
=
allModels
[
type
]);
}
else
if
((
prop
.
refDataType
!=
null
)
&&
(
allModels
[
prop
.
refDataType
]
!=
null
))
{
}
else
if
((
prop
.
refDataType
!=
null
)
&&
(
allModels
[
prop
.
refDataType
]
!=
null
))
{
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
refDataType
]);
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
refDataType
]);
}
else
{
}
else
{
...
@@ -516,7 +516,7 @@
...
@@ -516,7 +516,7 @@
SwaggerOperation
=
(
function
()
{
SwaggerOperation
=
(
function
()
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
responseClass
,
responseMessages
,
resource
,
consumes
,
produces
)
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
responseClass
,
responseMessages
,
resource
,
consumes
,
produces
)
{
var
parameter
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
var
parameter
,
type
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
_this
=
this
;
_this
=
this
;
this
.
nickname
=
nickname
;
this
.
nickname
=
nickname
;
this
.
path
=
path
;
this
.
path
=
path
;
...
@@ -555,13 +555,14 @@
...
@@ -555,13 +555,14 @@
_ref1
=
this
.
parameters
;
_ref1
=
this
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
parameter
=
_ref1
[
_i
];
parameter
=
_ref1
[
_i
];
parameter
.
name
=
parameter
.
name
||
parameter
.
dataType
;
parameter
.
name
=
parameter
.
name
||
parameter
.
type
||
parameter
.
dataType
;
if
(
parameter
.
dataType
.
toLowerCase
()
===
'
boolean
'
)
{
type
=
parameter
.
type
||
parameter
.
dataType
;
if
(
type
.
toLowerCase
()
===
'
boolean
'
)
{
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
.
values
=
this
.
resource
.
api
.
booleanValues
;
parameter
.
allowableValues
.
values
=
this
.
resource
.
api
.
booleanValues
;
}
}
parameter
.
signature
=
this
.
getSignature
(
parameter
.
dataT
ype
,
this
.
resource
.
models
);
parameter
.
signature
=
this
.
getSignature
(
t
ype
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
parameter
.
dataT
ype
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
t
ype
,
this
.
resource
.
models
);
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
parameter
.
isRange
=
true
;
parameter
.
isRange
=
true
;
...
@@ -596,34 +597,34 @@
...
@@ -596,34 +597,34 @@
};
};
}
}
SwaggerOperation
.
prototype
.
isListType
=
function
(
dataT
ype
)
{
SwaggerOperation
.
prototype
.
isListType
=
function
(
t
ype
)
{
if
(
dataT
ype
.
indexOf
(
'
[
'
)
>=
0
)
{
if
(
t
ype
.
indexOf
(
'
[
'
)
>=
0
)
{
return
dataT
ype
.
substring
(
dataT
ype
.
indexOf
(
'
[
'
)
+
1
,
dataT
ype
.
indexOf
(
'
]
'
));
return
t
ype
.
substring
(
t
ype
.
indexOf
(
'
[
'
)
+
1
,
t
ype
.
indexOf
(
'
]
'
));
}
else
{
}
else
{
return
void
0
;
return
void
0
;
}
}
};
};
SwaggerOperation
.
prototype
.
getSignature
=
function
(
dataT
ype
,
models
)
{
SwaggerOperation
.
prototype
.
getSignature
=
function
(
t
ype
,
models
)
{
var
isPrimitive
,
listType
;
var
isPrimitive
,
listType
;
listType
=
this
.
isListType
(
dataT
ype
);
listType
=
this
.
isListType
(
t
ype
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
dataT
ype
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
t
ype
]
!=
null
)
?
false
:
true
;
if
(
isPrimitive
)
{
if
(
isPrimitive
)
{
return
dataT
ype
;
return
t
ype
;
}
else
{
}
else
{
if
(
listType
!=
null
)
{
if
(
listType
!=
null
)
{
return
models
[
listType
].
getMockSignature
();
return
models
[
listType
].
getMockSignature
();
}
else
{
}
else
{
return
models
[
dataT
ype
].
getMockSignature
();
return
models
[
t
ype
].
getMockSignature
();
}
}
}
}
};
};
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
dataT
ype
,
models
)
{
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
t
ype
,
models
)
{
var
isPrimitive
,
listType
,
val
;
var
isPrimitive
,
listType
,
val
;
listType
=
this
.
isListType
(
dataT
ype
);
listType
=
this
.
isListType
(
t
ype
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
dataT
ype
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
t
ype
]
!=
null
)
?
false
:
true
;
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
dataT
ype
].
createJSONSample
());
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
t
ype
].
createJSONSample
());
if
(
val
)
{
if
(
val
)
{
val
=
listType
?
[
val
]
:
val
;
val
=
listType
?
[
val
]
:
val
;
return
JSON
.
stringify
(
val
,
null
,
2
);
return
JSON
.
stringify
(
val
,
null
,
2
);
...
@@ -849,13 +850,14 @@
...
@@ -849,13 +850,14 @@
}
}
return
_results
;
return
_results
;
}).
call
(
this
)).
length
>
0
)
{
}).
call
(
this
)).
length
>
0
)
{
type
=
param
.
type
||
param
.
dataType
;
if
(((
function
()
{
if
(((
function
()
{
var
_i
,
_len
,
_ref
,
_results
;
var
_i
,
_len
,
_ref
,
_results
;
_ref
=
this
.
operation
.
parameters
;
_ref
=
this
.
operation
.
parameters
;
_results
=
[];
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
[
_i
];
param
=
_ref
[
_i
];
if
(
param
.
dataT
ype
.
toLowerCase
()
===
"
file
"
)
{
if
(
t
ype
.
toLowerCase
()
===
"
file
"
)
{
_results
.
push
(
param
);
_results
.
push
(
param
);
}
}
}
}
...
@@ -878,14 +880,14 @@
...
@@ -878,14 +880,14 @@
}
}
}
}
responseContentType
=
null
;
responseContentType
=
null
;
if
(
this
.
type
===
"
POST
"
||
this
.
type
===
"
GET
"
)
{
if
(
this
.
type
===
"
POST
"
||
this
.
type
===
"
GET
"
||
this
.
type
===
"
PATCH
"
||
this
.
type
===
"
PUT
"
)
{
if
(
this
.
opts
.
responseContentType
)
{
if
(
this
.
opts
.
responseContentType
)
{
re
sponse
ContentType
=
this
.
opts
.
re
sponse
ContentType
;
re
quest
ContentType
=
this
.
opts
.
re
quest
ContentType
;
}
else
{
}
else
{
re
sponse
ContentType
=
"
application/json
"
;
re
quest
ContentType
=
"
application/json
"
;
}
}
}
else
{
}
else
{
re
sponse
ContentType
=
null
;
re
quest
ContentType
=
null
;
}
}
if
(
responseContentType
&&
this
.
operation
.
produces
)
{
if
(
responseContentType
&&
this
.
operation
.
produces
)
{
if
(
this
.
operation
.
produces
.
indexOf
(
responseContentType
)
===
-
1
)
{
if
(
this
.
operation
.
produces
.
indexOf
(
responseContentType
)
===
-
1
)
{
...
...
dist/swagger-ui.js
View file @
4b5e4e5d
...
@@ -1729,7 +1729,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
...
@@ -1729,7 +1729,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
OperationView
.
prototype
.
initialize
=
function
()
{};
OperationView
.
prototype
.
initialize
=
function
()
{};
OperationView
.
prototype
.
render
=
function
()
{
OperationView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
;
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
type
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref1
,
_ref2
;
isMethodSubmissionSupported
=
true
;
isMethodSubmissionSupported
=
true
;
if
(
!
isMethodSubmissionSupported
)
{
if
(
!
isMethodSubmissionSupported
)
{
this
.
model
.
isReadOnly
=
true
;
this
.
model
.
isReadOnly
=
true
;
...
@@ -1757,7 +1757,8 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
...
@@ -1757,7 +1757,8 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
_ref
=
this
.
model
.
parameters
;
_ref
=
this
.
model
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
[
_i
];
param
=
_ref
[
_i
];
if
(
param
.
dataType
.
toLowerCase
()
===
'
file
'
)
{
type
=
param
.
type
||
param
.
dataType
;
if
(
type
.
toLowerCase
()
===
'
file
'
)
{
if
(
!
contentTypeModel
.
consumes
)
{
if
(
!
contentTypeModel
.
consumes
)
{
console
.
log
(
"
set content type
"
);
console
.
log
(
"
set content type
"
);
contentTypeModel
.
consumes
=
'
multipart/form-data
'
;
contentTypeModel
.
consumes
=
'
multipart/form-data
'
;
...
@@ -1802,7 +1803,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
...
@@ -1802,7 +1803,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
};
};
OperationView
.
prototype
.
submitOperation
=
function
(
e
)
{
OperationView
.
prototype
.
submitOperation
=
function
(
e
)
{
var
error_free
,
form
,
map
,
o
,
opts
,
_i
,
_len
,
_
ref
;
var
error_free
,
form
,
map
,
o
,
opts
,
_i
,
_j
,
_len
,
_
len1
,
_ref
,
_ref1
;
if
(
e
!=
null
)
{
if
(
e
!=
null
)
{
e
.
preventDefault
();
e
.
preventDefault
();
}
}
...
@@ -1833,6 +1834,13 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
...
@@ -1833,6 +1834,13 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
map
[
o
.
name
]
=
encodeURI
(
o
.
value
);
map
[
o
.
name
]
=
encodeURI
(
o
.
value
);
}
}
}
}
_ref1
=
form
.
find
(
"
textarea
"
);
for
(
_j
=
0
,
_len1
=
_ref1
.
length
;
_j
<
_len1
;
_j
++
)
{
o
=
_ref1
[
_j
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
"
body
"
]
=
o
.
value
;
}
}
opts
.
responseContentType
=
$
(
"
div select[name=responseContentType]
"
,
$
(
this
.
el
)).
val
();
opts
.
responseContentType
=
$
(
"
div select[name=responseContentType]
"
,
$
(
this
.
el
)).
val
();
opts
.
requestContentType
=
$
(
"
div select[name=parameterContentType]
"
,
$
(
this
.
el
)).
val
();
opts
.
requestContentType
=
$
(
"
div select[name=parameterContentType]
"
,
$
(
this
.
el
)).
val
();
return
this
.
model
[
"
do
"
](
map
,
opts
,
this
.
showCompleteStatus
,
this
.
showErrorStatus
,
this
);
return
this
.
model
[
"
do
"
](
map
,
opts
,
this
.
showCompleteStatus
,
this
.
showErrorStatus
,
this
);
...
@@ -2020,11 +2028,12 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
...
@@ -2020,11 +2028,12 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
ParameterView
.
prototype
.
initialize
=
function
()
{};
ParameterView
.
prototype
.
initialize
=
function
()
{};
ParameterView
.
prototype
.
render
=
function
()
{
ParameterView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isParam
,
parameterContentTypeView
,
responseContentTypeView
,
signatureModel
,
signatureView
,
template
;
var
contentTypeModel
,
isParam
,
parameterContentTypeView
,
responseContentTypeView
,
signatureModel
,
signatureView
,
template
,
type
;
type
=
this
.
model
.
type
||
this
.
model
.
dataType
;
if
(
this
.
model
.
paramType
===
'
body
'
)
{
if
(
this
.
model
.
paramType
===
'
body
'
)
{
this
.
model
.
isBody
=
true
;
this
.
model
.
isBody
=
true
;
}
}
if
(
t
his
.
model
.
dataT
ype
.
toLowerCase
()
===
'
file
'
)
{
if
(
type
.
toLowerCase
()
===
'
file
'
)
{
this
.
model
.
isFile
=
true
;
this
.
model
.
isFile
=
true
;
}
}
template
=
this
.
template
();
template
=
this
.
template
();
...
...
dist/swagger-ui.min.js
View file @
4b5e4e5d
This diff is collapsed.
Click to expand it.
lib/swagger.js
View file @
4b5e4e5d
...
@@ -49,7 +49,6 @@
...
@@ -49,7 +49,6 @@
var
e
,
obj
,
var
e
,
obj
,
_this
=
this
;
_this
=
this
;
this
.
progress
(
'
fetching resource list:
'
+
this
.
url
);
this
.
progress
(
'
fetching resource list:
'
+
this
.
url
);
console
.
log
(
'
getting
'
+
this
.
url
);
obj
=
{
obj
=
{
url
:
this
.
url
,
url
:
this
.
url
,
method
:
"
get
"
,
method
:
"
get
"
,
...
@@ -387,13 +386,14 @@
...
@@ -387,13 +386,14 @@
}
}
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
SwaggerModel
.
prototype
.
setReferencedModels
=
function
(
allModels
)
{
var
prop
,
_i
,
_len
,
_ref
,
_results
;
var
prop
,
type
,
_i
,
_len
,
_ref
,
_results
;
_ref
=
this
.
properties
;
_ref
=
this
.
properties
;
_results
=
[];
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
prop
=
_ref
[
_i
];
prop
=
_ref
[
_i
];
if
(
allModels
[
prop
.
dataType
]
!=
null
)
{
type
=
prop
.
type
||
prop
.
dataType
;
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
dataType
]);
if
(
allModels
[
type
]
!=
null
)
{
_results
.
push
(
prop
.
refModel
=
allModels
[
type
]);
}
else
if
((
prop
.
refDataType
!=
null
)
&&
(
allModels
[
prop
.
refDataType
]
!=
null
))
{
}
else
if
((
prop
.
refDataType
!=
null
)
&&
(
allModels
[
prop
.
refDataType
]
!=
null
))
{
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
refDataType
]);
_results
.
push
(
prop
.
refModel
=
allModels
[
prop
.
refDataType
]);
}
else
{
}
else
{
...
@@ -516,7 +516,7 @@
...
@@ -516,7 +516,7 @@
SwaggerOperation
=
(
function
()
{
SwaggerOperation
=
(
function
()
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
responseClass
,
responseMessages
,
resource
,
consumes
,
produces
)
{
function
SwaggerOperation
(
nickname
,
path
,
method
,
parameters
,
summary
,
notes
,
responseClass
,
responseMessages
,
resource
,
consumes
,
produces
)
{
var
parameter
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
var
parameter
,
type
,
v
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_ref2
,
_this
=
this
;
_this
=
this
;
this
.
nickname
=
nickname
;
this
.
nickname
=
nickname
;
this
.
path
=
path
;
this
.
path
=
path
;
...
@@ -555,13 +555,14 @@
...
@@ -555,13 +555,14 @@
_ref1
=
this
.
parameters
;
_ref1
=
this
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
parameter
=
_ref1
[
_i
];
parameter
=
_ref1
[
_i
];
parameter
.
name
=
parameter
.
name
||
parameter
.
dataType
;
parameter
.
name
=
parameter
.
name
||
parameter
.
type
||
parameter
.
dataType
;
if
(
parameter
.
dataType
.
toLowerCase
()
===
'
boolean
'
)
{
type
=
parameter
.
type
||
parameter
.
dataType
;
if
(
type
.
toLowerCase
()
===
'
boolean
'
)
{
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
=
{};
parameter
.
allowableValues
.
values
=
this
.
resource
.
api
.
booleanValues
;
parameter
.
allowableValues
.
values
=
this
.
resource
.
api
.
booleanValues
;
}
}
parameter
.
signature
=
this
.
getSignature
(
parameter
.
dataT
ype
,
this
.
resource
.
models
);
parameter
.
signature
=
this
.
getSignature
(
t
ype
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
parameter
.
dataT
ype
,
this
.
resource
.
models
);
parameter
.
sampleJSON
=
this
.
getSampleJSON
(
t
ype
,
this
.
resource
.
models
);
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
!=
null
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
if
(
parameter
.
allowableValues
.
valueType
===
"
RANGE
"
)
{
parameter
.
isRange
=
true
;
parameter
.
isRange
=
true
;
...
@@ -596,34 +597,34 @@
...
@@ -596,34 +597,34 @@
};
};
}
}
SwaggerOperation
.
prototype
.
isListType
=
function
(
dataT
ype
)
{
SwaggerOperation
.
prototype
.
isListType
=
function
(
t
ype
)
{
if
(
dataT
ype
.
indexOf
(
'
[
'
)
>=
0
)
{
if
(
t
ype
.
indexOf
(
'
[
'
)
>=
0
)
{
return
dataT
ype
.
substring
(
dataT
ype
.
indexOf
(
'
[
'
)
+
1
,
dataT
ype
.
indexOf
(
'
]
'
));
return
t
ype
.
substring
(
t
ype
.
indexOf
(
'
[
'
)
+
1
,
t
ype
.
indexOf
(
'
]
'
));
}
else
{
}
else
{
return
void
0
;
return
void
0
;
}
}
};
};
SwaggerOperation
.
prototype
.
getSignature
=
function
(
dataT
ype
,
models
)
{
SwaggerOperation
.
prototype
.
getSignature
=
function
(
t
ype
,
models
)
{
var
isPrimitive
,
listType
;
var
isPrimitive
,
listType
;
listType
=
this
.
isListType
(
dataT
ype
);
listType
=
this
.
isListType
(
t
ype
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
dataT
ype
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
t
ype
]
!=
null
)
?
false
:
true
;
if
(
isPrimitive
)
{
if
(
isPrimitive
)
{
return
dataT
ype
;
return
t
ype
;
}
else
{
}
else
{
if
(
listType
!=
null
)
{
if
(
listType
!=
null
)
{
return
models
[
listType
].
getMockSignature
();
return
models
[
listType
].
getMockSignature
();
}
else
{
}
else
{
return
models
[
dataT
ype
].
getMockSignature
();
return
models
[
t
ype
].
getMockSignature
();
}
}
}
}
};
};
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
dataT
ype
,
models
)
{
SwaggerOperation
.
prototype
.
getSampleJSON
=
function
(
t
ype
,
models
)
{
var
isPrimitive
,
listType
,
val
;
var
isPrimitive
,
listType
,
val
;
listType
=
this
.
isListType
(
dataT
ype
);
listType
=
this
.
isListType
(
t
ype
);
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
dataT
ype
]
!=
null
)
?
false
:
true
;
isPrimitive
=
((
listType
!=
null
)
&&
models
[
listType
])
||
(
models
[
t
ype
]
!=
null
)
?
false
:
true
;
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
dataT
ype
].
createJSONSample
());
val
=
isPrimitive
?
void
0
:
(
listType
!=
null
?
models
[
listType
].
createJSONSample
()
:
models
[
t
ype
].
createJSONSample
());
if
(
val
)
{
if
(
val
)
{
val
=
listType
?
[
val
]
:
val
;
val
=
listType
?
[
val
]
:
val
;
return
JSON
.
stringify
(
val
,
null
,
2
);
return
JSON
.
stringify
(
val
,
null
,
2
);
...
@@ -849,13 +850,14 @@
...
@@ -849,13 +850,14 @@
}
}
return
_results
;
return
_results
;
}).
call
(
this
)).
length
>
0
)
{
}).
call
(
this
)).
length
>
0
)
{
type
=
param
.
type
||
param
.
dataType
;
if
(((
function
()
{
if
(((
function
()
{
var
_i
,
_len
,
_ref
,
_results
;
var
_i
,
_len
,
_ref
,
_results
;
_ref
=
this
.
operation
.
parameters
;
_ref
=
this
.
operation
.
parameters
;
_results
=
[];
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
[
_i
];
param
=
_ref
[
_i
];
if
(
param
.
dataT
ype
.
toLowerCase
()
===
"
file
"
)
{
if
(
t
ype
.
toLowerCase
()
===
"
file
"
)
{
_results
.
push
(
param
);
_results
.
push
(
param
);
}
}
}
}
...
@@ -878,14 +880,14 @@
...
@@ -878,14 +880,14 @@
}
}
}
}
responseContentType
=
null
;
responseContentType
=
null
;
if
(
this
.
type
===
"
POST
"
||
this
.
type
===
"
GET
"
)
{
if
(
this
.
type
===
"
POST
"
||
this
.
type
===
"
GET
"
||
this
.
type
===
"
PATCH
"
||
this
.
type
===
"
PUT
"
)
{
if
(
this
.
opts
.
responseContentType
)
{
if
(
this
.
opts
.
responseContentType
)
{
re
sponse
ContentType
=
this
.
opts
.
re
sponse
ContentType
;
re
quest
ContentType
=
this
.
opts
.
re
quest
ContentType
;
}
else
{
}
else
{
re
sponse
ContentType
=
"
application/json
"
;
re
quest
ContentType
=
"
application/json
"
;
}
}
}
else
{
}
else
{
re
sponse
ContentType
=
null
;
re
quest
ContentType
=
null
;
}
}
if
(
responseContentType
&&
this
.
operation
.
produces
)
{
if
(
responseContentType
&&
this
.
operation
.
produces
)
{
if
(
this
.
operation
.
produces
.
indexOf
(
responseContentType
)
===
-
1
)
{
if
(
this
.
operation
.
produces
.
indexOf
(
responseContentType
)
===
-
1
)
{
...
...
src/main/coffeescript/view/OperationView.coffee
View file @
4b5e4e5d
...
@@ -32,7 +32,8 @@ class OperationView extends Backbone.View
...
@@ -32,7 +32,8 @@ class OperationView extends Backbone.View
contentTypeModel
.
produces
=
@
model
.
produces
contentTypeModel
.
produces
=
@
model
.
produces
for
param
in
@
model
.
parameters
for
param
in
@
model
.
parameters
if
param
.
dataType
.
toLowerCase
()
==
'file'
type
=
param
.
type
||
param
.
dataType
if
type
.
toLowerCase
()
==
'file'
if
!
contentTypeModel
.
consumes
if
!
contentTypeModel
.
consumes
console
.
log
"set content type "
console
.
log
"set content type "
contentTypeModel
.
consumes
=
'multipart/form-data'
contentTypeModel
.
consumes
=
'multipart/form-data'
...
@@ -84,6 +85,10 @@ class OperationView extends Backbone.View
...
@@ -84,6 +85,10 @@ class OperationView extends Backbone.View
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
map
[
o
.
name
]
=
encodeURI
(
o
.
value
)
map
[
o
.
name
]
=
encodeURI
(
o
.
value
)
for
o
in
form
.
find
(
"textarea"
)
if
(
o
.
value
?
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
map
[
"body"
]
=
o
.
value
opts
.
responseContentType
=
$
(
"div select[name=responseContentType]"
,
$
(
@
el
)).
val
()
opts
.
responseContentType
=
$
(
"div select[name=responseContentType]"
,
$
(
@
el
)).
val
()
opts
.
requestContentType
=
$
(
"div select[name=parameterContentType]"
,
$
(
@
el
)).
val
()
opts
.
requestContentType
=
$
(
"div select[name=parameterContentType]"
,
$
(
@
el
)).
val
()
...
...
src/main/coffeescript/view/ParameterView.coffee
View file @
4b5e4e5d
...
@@ -2,8 +2,9 @@ class ParameterView extends Backbone.View
...
@@ -2,8 +2,9 @@ class ParameterView extends Backbone.View
initialize
:
->
initialize
:
->
render
:
->
render
:
->
type
=
@
model
.
type
||
@
model
.
dataType
@
model
.
isBody
=
true
if
@
model
.
paramType
==
'body'
@
model
.
isBody
=
true
if
@
model
.
paramType
==
'body'
@
model
.
isFile
=
true
if
@
model
.
dataT
ype
.
toLowerCase
()
==
'file'
@
model
.
isFile
=
true
if
t
ype
.
toLowerCase
()
==
'file'
template
=
@
template
()
template
=
@
template
()
$
(
@
el
).
html
(
template
(
@
model
))
$
(
@
el
).
html
(
template
(
@
model
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment