feat: sample-gen mulit and form media-type (#6874)

* application/x-www-form-urlencoded || **multipart/** initial value should rely on sample gen
This commit is contained in:
Mahtis Michel
2021-02-03 21:04:12 +01:00
committed by GitHub
parent 23323bbbff
commit 8ed6c34958
2 changed files with 61 additions and 59 deletions

View File

@@ -129,8 +129,9 @@ export class JsonSchema_array extends PureComponent {
}
componentWillReceiveProps(props) {
if(props.value !== this.state.value)
this.setState({ value: props.value })
const value = valueOrEmptyList(props.value)
if(value !== this.state.value)
this.setState({ value })
if(props.schema !== this.state.schema)
this.setState({ schema: props.schema })
@@ -151,7 +152,7 @@ export class JsonSchema_array extends PureComponent {
value: value.delete(i)
}), this.onChange)
}
addItem = () => {
let newValue = valueOrEmptyList(this.state.value)
this.setState(() => ({
@@ -382,5 +383,5 @@ export class JsonSchema_object extends PureComponent {
}
function valueOrEmptyList(value) {
return List.isList(value) ? value : List()
return List.isList(value) ? value : Array.isArray(value) ? fromJS(value) : List()
}