Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Sunny_yiyi
Swagger Ui
提交
55f0c1a2
S
Swagger Ui
项目概览
Sunny_yiyi
/
Swagger Ui
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Swagger Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
55f0c1a2
编写于
11月 25, 2012
作者:
T
Tony Tam
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #95 from pose/json-response-pretty-print
Adding JSON sample UI to response
上级
03e21019
dd1b2219
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
11 deletion
+33
-11
lib/swagger.js
lib/swagger.js
+1
-0
src/main/coffeescript/view/OperationView.coffee
src/main/coffeescript/view/OperationView.coffee
+12
-0
src/main/coffeescript/view/ParameterView.coffee
src/main/coffeescript/view/ParameterView.coffee
+6
-1
src/main/coffeescript/view/SignatureView.coffee
src/main/coffeescript/view/SignatureView.coffee
+11
-3
src/main/template/operation.handlebars
src/main/template/operation.handlebars
+2
-6
src/main/template/signature.handlebars
src/main/template/signature.handlebars
+1
-1
未找到文件。
lib/swagger.js
浏览文件 @
55f0c1a2
...
...
@@ -445,6 +445,7 @@
}
if
(
this
.
responseClass
!=
null
)
{
this
.
responseClassSignature
=
this
.
getSignature
(
this
.
responseClass
,
this
.
resource
.
models
);
this
.
responseSampleJSON
=
this
.
getSampleJSON
(
this
.
responseClass
,
this
.
resource
.
models
);
}
this
.
errorResponses
=
this
.
errorResponses
||
[];
_ref1
=
this
.
parameters
;
...
...
src/main/coffeescript/view/OperationView.coffee
浏览文件 @
55f0c1a2
...
...
@@ -14,6 +14,18 @@ class OperationView extends Backbone.View
$
(
@
el
).
html
(
Handlebars
.
templates
.
operation
(
@
model
))
if
@
model
.
responseClassSignature
and
@
model
.
responseClassSignature
!=
'string'
signatureModel
=
sampleJSON
:
@
model
.
responseSampleJSON
isParam
:
false
signature
:
@
model
.
responseClassSignature
responseSignatureView
=
new
SignatureView
({
model
:
signatureModel
,
tagName
:
'div'
})
$
(
'.model-signature'
,
$
(
@
el
)).
append
responseSignatureView
.
render
().
el
else
$
(
'.model-signature'
,
$
(
@
el
)).
html
(
@
model
.
responseClass
)
# Render each parameter
@
addParameter
param
for
param
in
@
model
.
parameters
...
...
src/main/coffeescript/view/ParameterView.coffee
浏览文件 @
55f0c1a2
...
...
@@ -8,8 +8,13 @@ class ParameterView extends Backbone.View
template
=
@
template
()
$
(
@
el
).
html
(
template
(
@
model
))
signatureModel
=
sampleJSON
:
@
model
.
sampleJSON
isParam
:
true
signature
:
@
model
.
signature
if
@
model
.
sampleJSON
signatureView
=
new
SignatureView
({
model
:
@
m
odel
,
tagName
:
'div'
})
signatureView
=
new
SignatureView
({
model
:
signatureM
odel
,
tagName
:
'div'
})
$
(
'.model-signature'
,
$
(
@
el
)).
append
signatureView
.
render
().
el
else
$
(
'.model-signature'
,
$
(
@
el
)).
html
(
@
model
.
signature
)
...
...
src/main/coffeescript/view/SignatureView.coffee
浏览文件 @
55f0c1a2
...
...
@@ -13,6 +13,11 @@ class SignatureView extends Backbone.View
@
switchToDescription
()
@
isParam
=
@
model
.
isParam
if
@
isParam
$
(
'.notice'
,
$
(
@
el
)).
text
(
'Click to set as parameter value'
)
@
template
:
->
...
...
@@ -36,8 +41,11 @@ class SignatureView extends Backbone.View
# handler for snippet to text area
snippetToTextArea
:
(
e
)
->
e
?
.
preventDefault
()
textArea
=
$
(
'textarea'
,
$
(
@
el
.
parentNode
.
parentNode
.
parentNode
))
if
$
.
trim
(
textArea
.
val
())
==
''
if
@
isParam
e
?
.
preventDefault
()
textArea
=
$
(
'textarea'
,
$
(
@
el
.
parentNode
.
parentNode
.
parentNode
))
if
$
.
trim
(
textArea
.
val
())
==
''
textArea
.
val
(
@
model
.
sampleJSON
)
src/main/template/operation.handlebars
浏览文件 @
55f0c1a2
...
...
@@ -22,12 +22,8 @@
<p>
{{{
notes
}}}
</p>
{{/if}}
{{#if
responseClass
}}
<h4>
Response Class
</h4>
{{#if
responseClassSignature
}}
<p><span
class=
"model-signature"
>
{{{
responseClassSignature
}}}
</span></p>
{{else}}
<p>
{{{
responseClass
}}}
</p>
{{/if}}
<h4>
Response Model
</h4>
<span
class=
"model-signature"
></span>
{{/if}}
<form
accept-charset=
'UTF-8'
class=
'sandbox'
>
<div
style=
'margin:0;padding:0;display:inline'
></div>
...
...
src/main/template/signature.handlebars
浏览文件 @
55f0c1a2
...
...
@@ -12,7 +12,7 @@
<div
class=
"snippet"
>
<pre><code>
{{
sampleJSON
}}
</code></pre>
<small
>
Click to set as parameter value
</small>
<small
class=
"notice"
>
</small>
</div>
</div>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录