Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Sunny_yiyi
Swagger Ui
提交
bbbd1b93
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,发现更多精彩内容 >>
未验证
提交
bbbd1b93
编写于
7月 14, 2018
作者:
K
kyle
提交者:
GitHub
7月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: OAS3 array item value input (#4729)
* fix: OAS3 array item value input * linter fixes
上级
e70a054b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
96 addition
and
13 deletion
+96
-13
src/core/components/parameter-row.jsx
src/core/components/parameter-row.jsx
+17
-13
test/e2e/scenarios/bugs/frozen-array-input.js
test/e2e/scenarios/bugs/frozen-array-input.js
+44
-0
test/e2e/specs/bugs/frozen-array-input.yaml
test/e2e/specs/bugs/frozen-array-input.yaml
+35
-0
未找到文件。
src/core/components/parameter-row.jsx
浏览文件 @
bbbd1b93
...
...
@@ -27,20 +27,24 @@ export default class ParameterRow extends Component {
}
componentWillReceiveProps
(
props
)
{
let
{
specSelectors
,
pathMethod
,
p
aram
}
=
props
let
{
specSelectors
,
pathMethod
,
rawP
aram
}
=
props
let
{
isOAS3
}
=
specSelectors
let
example
=
param
.
get
(
"
example
"
)
let
parameter
=
specSelectors
.
parameterWithMetaByIdentity
(
pathMethod
,
param
)
||
param
let
example
=
rawParam
.
get
(
"
example
"
)
let
parameterWithMeta
=
specSelectors
.
parameterWithMetaByIdentity
(
pathMethod
,
rawParam
)
// fallback, if the meta lookup fails
parameterWithMeta
=
parameterWithMeta
.
isEmpty
()
?
rawParam
:
parameterWithMeta
let
enumValue
if
(
isOAS3
())
{
let
schema
=
p
aram
.
get
(
"
schema
"
)
||
Map
()
let
schema
=
rawP
aram
.
get
(
"
schema
"
)
||
Map
()
enumValue
=
schema
.
get
(
"
enum
"
)
}
else
{
enumValue
=
parameter
?
parameter
.
get
(
"
enum
"
)
:
undefined
enumValue
=
parameter
WithMeta
?
parameterWithMeta
.
get
(
"
enum
"
)
:
undefined
}
let
paramValue
=
parameter
?
parameter
.
get
(
"
value
"
)
:
undefined
let
paramValue
=
parameter
WithMeta
?
parameterWithMeta
.
get
(
"
value
"
)
:
undefined
let
value
...
...
@@ -48,7 +52,7 @@ export default class ParameterRow extends Component {
value
=
paramValue
}
else
if
(
example
!==
undefined
)
{
value
=
example
}
else
if
(
p
aram
.
get
(
"
required
"
)
&&
enumValue
&&
enumValue
.
size
)
{
}
else
if
(
rawP
aram
.
get
(
"
required
"
)
&&
enumValue
&&
enumValue
.
size
)
{
value
=
enumValue
.
first
()
}
...
...
@@ -63,20 +67,20 @@ export default class ParameterRow extends Component {
}
setDefaultValue
=
()
=>
{
let
{
specSelectors
,
pathMethod
,
p
aram
}
=
this
.
props
let
{
specSelectors
,
pathMethod
,
rawP
aram
}
=
this
.
props
if
(
p
aram
.
get
(
"
value
"
)
!==
undefined
)
{
if
(
rawP
aram
.
get
(
"
value
"
)
!==
undefined
)
{
return
}
let
schema
=
specSelectors
.
isOAS3
()
?
param
.
get
(
"
schema
"
,
Map
({}))
:
p
aram
let
schema
=
specSelectors
.
isOAS3
()
?
rawParam
.
get
(
"
schema
"
,
Map
({}))
:
rawP
aram
let
defaultValue
=
schema
.
get
(
"
default
"
)
let
xExampleValue
=
p
aram
.
get
(
"
x-example
"
)
// Swagger 2 only
let
parameter
=
specSelectors
.
parameterWithMetaByIdentity
(
pathMethod
,
p
aram
)
let
xExampleValue
=
rawP
aram
.
get
(
"
x-example
"
)
// Swagger 2 only
let
parameter
=
specSelectors
.
parameterWithMetaByIdentity
(
pathMethod
,
rawP
aram
)
let
value
=
parameter
?
parameter
.
get
(
"
value
"
)
:
""
if
(
p
aram
.
get
(
"
in
"
)
!==
"
body
"
)
{
if
(
rawP
aram
.
get
(
"
in
"
)
!==
"
body
"
)
{
if
(
xExampleValue
!==
undefined
&&
value
===
undefined
&&
specSelectors
.
isSwagger2
()
)
{
this
.
onChangeWrapper
(
xExampleValue
)
}
else
if
(
defaultValue
!==
undefined
&&
value
===
undefined
)
{
...
...
test/e2e/scenarios/bugs/frozen-array-input.js
0 → 100644
浏览文件 @
bbbd1b93
describe
(
"
bug: unable to change array input
"
,
function
()
{
let
mainPage
beforeEach
(
function
(
client
,
done
)
{
mainPage
=
client
.
url
(
"
localhost:3230
"
)
.
page
.
main
()
client
.
waitForElementVisible
(
"
.download-url-input:not([disabled])
"
,
5000
)
.
clearValue
(
"
.download-url-input
"
)
.
setValue
(
"
.download-url-input
"
,
"
/test-specs/bugs/frozen-array-input.yaml
"
)
.
click
(
"
button.download-url-button
"
)
done
()
})
afterEach
(
function
(
client
,
done
)
{
done
()
})
it
(
"
consistently displays a model's name regardless of expansion state
"
,
function
(
client
)
{
client
.
waitForElementVisible
(
"
.opblock-summary-description
"
,
10000
)
.
assert
.
containsText
(
"
span.opblock-summary-path > a > span
"
,
"
/test
"
)
.
click
(
"
#operations-default-get_test
"
)
.
pause
(
500
)
.
click
(
"
button.btn.try-out__btn
"
)
.
elements
(
"
css selector
"
,
"
.json-schema-form-item
"
,
function
(
result
)
{
this
.
assert
.
equal
(
result
.
value
.
length
,
2
,
"
initial number of array item inputs
"
)
})
.
click
(
"
.json-schema-form-item-add
"
)
.
elements
(
"
css selector
"
,
"
.json-schema-form-item
"
,
function
(
result
)
{
this
.
assert
.
equal
(
result
.
value
.
length
,
3
,
"
number of array item inputs after clicking add
"
)
})
.
click
(
"
.json-schema-form-item-remove
"
)
.
click
(
"
.json-schema-form-item-remove
"
)
.
click
(
"
.json-schema-form-item-remove
"
)
.
elements
(
"
css selector
"
,
"
.json-schema-form-item
"
,
function
(
result
)
{
this
.
assert
.
equal
(
result
.
value
.
length
,
0
,
"
number of array item inputs after removing all items
"
)
})
.
click
(
"
.json-schema-form-item-add
"
)
.
setValue
(
"
.json-schema-form-item input
"
,
"
myValue123
"
)
.
click
(
"
button.execute
"
)
.
pause
(
100
)
.
assert
.
containsText
(
"
.request-url pre
"
,
"
http://localhost:3230/test?fields=myValue123
"
)
client
.
end
()
})
})
test/e2e/specs/bugs/frozen-array-input.yaml
0 → 100644
浏览文件 @
bbbd1b93
openapi
:
'
3.0.0'
info
:
description
:
>-
Repro API
title
:
Repro API
version
:
'
1.0'
paths
:
/test
:
get
:
summary
:
Test get
parameters
:
-
name
:
fields
in
:
query
required
:
false
explode
:
false
schema
:
type
:
array
items
:
type
:
string
style
:
form
example
:
-
friends
-
family
responses
:
200
:
description
:
Success!
content
:
application/json
:
schema
:
type
:
object
properties
:
id
:
type
:
integer
name
:
type
:
string
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录