Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Sunny_yiyi
Swagger Ui
提交
73f17ddf
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,发现更多精彩内容 >>
提交
73f17ddf
编写于
8月 10, 2017
作者:
K
Kyle
提交者:
GitHub
8月 10, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into bug/3555-multipart-curl
上级
168e2030
8de1add2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
109 addition
and
15 deletion
+109
-15
.github/issue_template.md
.github/issue_template.md
+63
-3
src/core/components/layouts/base.jsx
src/core/components/layouts/base.jsx
+4
-1
src/core/components/operation.jsx
src/core/components/operation.jsx
+1
-1
src/core/components/schemes.jsx
src/core/components/schemes.jsx
+3
-3
test/components/schemes.js
test/components/schemes.js
+38
-7
未找到文件。
.github/issue_template.md
浏览文件 @
73f17ddf
When reporting an issue, please provide the following details:
-
swagger-ui version
-
a swagger file reproducing the issue
<!---
Thanks for filing an issue 😄 ! Before you submit, please read the following:
Search open/closed issues before submitting since someone might have asked the same thing before!
Issues on GitHub are only related to problems of Swagger-UI itself. We'll try to offer support
here for your use case, but we can't offer help with projects that use Swagger-UI indirectly,
like Springfox or swagger-node.
Likewise, we can't accept features or bugs in the Swagger/OpenAPI specifications themselves,
or anything that violates the specifications.
-->
<!--- Provide a general summary of the issue in the title above -->
| Q | A
| ------------------------------- | -------
| Bug or feature request? |
| Which Swagger/OpenAPI version? |
| Which Swagger-UI version? |
| How did you install Swagger-UI? |
| Which broswer & version? |
| Which operating system? |
### Demonstration API definition
<!--- If you're describing a bug, please provide an API definition that reproduces your problem -->
<!--- If you have link to a demo repo please link that! -->
<!--- If your spec is large, please put it into a Gist (https://gist.github.com) instead of pasting it here. -->
```
yaml
your
:
"
API
definition
goes
here"
```
### Configuration (browser query string, constructor, config.yaml)
<!--- If describing a bug, tell us what your configuration looks like -->
```
js
{
"
your
"
:
{
"
constructorConfig
"
:
"
here
"
}
}
```
`?yourQueryStringConfig=here`
### Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
### Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
### Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
### Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
src/core/components/layouts/base.jsx
浏览文件 @
73f17ddf
...
...
@@ -69,7 +69,10 @@ export default class BaseLayout extends React.Component {
<
div
className
=
"scheme-container"
>
<
Col
className
=
"schemes wrapper"
mobile
=
{
12
}
>
{
schemes
&&
schemes
.
size
?
(
<
Schemes
schemes
=
{
schemes
}
specActions
=
{
specActions
}
/>
<
Schemes
currentScheme
=
{
specSelectors
.
operationScheme
()
}
schemes
=
{
schemes
}
specActions
=
{
specActions
}
/>
)
:
null
}
{
securityDefinitions
?
(
...
...
src/core/components/operation.jsx
浏览文件 @
73f17ddf
...
...
@@ -229,7 +229,7 @@ export default class Operation extends PureComponent {
path
=
{
path
}
method
=
{
method
}
specActions
=
{
specActions
}
operation
Scheme
=
{
operationScheme
}
/>
current
Scheme
=
{
operationScheme
}
/>
</
div
>
:
null
}
...
...
src/core/components/schemes.jsx
浏览文件 @
73f17ddf
...
...
@@ -6,9 +6,9 @@ export default class Schemes extends React.Component {
static
propTypes
=
{
specActions
:
PropTypes
.
object
.
isRequired
,
schemes
:
PropTypes
.
object
.
isRequired
,
currentScheme
:
PropTypes
.
string
.
isRequired
,
path
:
PropTypes
.
string
,
method
:
PropTypes
.
string
,
operationScheme
:
PropTypes
.
string
}
componentWillMount
()
{
...
...
@@ -19,8 +19,8 @@ export default class Schemes extends React.Component {
}
componentWillReceiveProps
(
nextProps
)
{
if
(
!
this
.
props
.
operationScheme
||
!
nextProps
.
schemes
.
has
(
this
.
props
.
operation
Scheme
)
)
{
// if we don't have a selected
operation
Scheme or if our selected scheme is no longer an option,
if
(
!
this
.
props
.
currentScheme
||
!
nextProps
.
schemes
.
includes
(
this
.
props
.
current
Scheme
)
)
{
// if we don't have a selected
current
Scheme or if our selected scheme is no longer an option,
// then fire 'change' event and select the first scheme in the list of options
this
.
setScheme
(
nextProps
.
schemes
.
first
())
}
...
...
test/components/schemes.js
浏览文件 @
73f17ddf
...
...
@@ -7,35 +7,66 @@ import { fromJS } from "immutable"
import
Schemes
from
"
components/schemes
"
describe
(
"
<Schemes/>
"
,
function
(){
it
(
"
calls props.specActions.setScheme() when no operationScheme is selected
"
,
function
(){
it
(
"
calls props.specActions.setScheme() when no currentScheme is selected
"
,
function
(){
let
setSchemeSpy
=
createSpy
()
// Given
let
props
=
{
specActions
:
{
setScheme
:
createSpy
()
setScheme
:
setSchemeSpy
},
schemes
:
fromJS
([
"
http
"
,
"
https
"
]),
operation
Scheme
:
undefined
,
current
Scheme
:
undefined
,
path
:
"
/test
"
,
method
:
"
get
"
}
// When
let
wrapper
=
shallow
(
<
Schemes
{...
props
}
/>
)
// Then
operation
Scheme should default to first scheme in options list
// Then
current
Scheme should default to first scheme in options list
expect
(
props
.
specActions
.
setScheme
).
toHaveBeenCalledWith
(
"
http
"
,
"
/test
"
,
"
get
"
)
// When the
operation
Scheme is no longer in the list of options
// When the
current
Scheme is no longer in the list of options
props
.
schemes
=
fromJS
([
"
https
"
])
wrapper
.
setProps
(
props
)
// Then
operationScheme should default to first scheme in options list
// Then
currentScheme should default to first scheme in options list, again
expect
(
props
.
specActions
.
setScheme
).
toHaveBeenCalledWith
(
"
https
"
,
"
/test
"
,
"
get
"
)
})
it
(
"
doesn't call props.specActions.setScheme() when schemes hasn't changed
"
,
function
(){
let
setSchemeSpy
=
createSpy
()
// Given
let
props
=
{
specActions
:
{
setScheme
:
setSchemeSpy
},
schemes
:
fromJS
([
"
http
"
,
"
https
"
]),
currentScheme
:
"
https
"
}
// When
let
wrapper
=
shallow
(
<
Schemes
{...
props
}
/>
)
// Should be called initially, to set the global state
expect
(
setSchemeSpy
.
calls
.
length
).
toEqual
(
1
)
// After an update
wrapper
.
instance
().
componentWillReceiveProps
(
props
)
// Should not be called again, since `currentScheme` is in schemes
expect
(
setSchemeSpy
.
calls
.
length
).
toEqual
(
1
)
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录