Compare commits

...
Author SHA1 Message Date
Kyle Shockey 73d2e90e12 fix: handle urlencoded array data correctly 2018-07-07 01:15:49 -05:00
2 changed files with 10 additions and 3 deletions
+7 -3
View File
@@ -111,7 +111,7 @@ export class JsonSchema_array extends PureComponent {
constructor(props, context) { constructor(props, context) {
super(props, context) super(props, context)
this.state = {value: props.value} this.state = { value: valueOrEmptyList(props.value)}
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
@@ -135,7 +135,7 @@ export class JsonSchema_array extends PureComponent {
addItem = () => { addItem = () => {
this.setState(state => { this.setState(state => {
state.value = state.value || List() state.value = valueOrEmptyList(state.value)
return { return {
value: state.value.push("") value: state.value.push("")
} }
@@ -174,7 +174,7 @@ export class JsonSchema_array extends PureComponent {
return ( return (
<div> <div>
{ !value || value.count() < 1 ? null : { !value || !value.count || value.count() < 1 ? null :
value.map( (item,i) => { value.map( (item,i) => {
let schema = Object.assign({}, itemSchema) let schema = Object.assign({}, itemSchema)
if ( errors.length ) { if ( errors.length ) {
@@ -264,3 +264,7 @@ export class JsonSchema_object extends PureComponent {
} }
} }
function valueOrEmptyList(value) {
return List.isList(value) ? value : List()
}
@@ -10,6 +10,7 @@ const RequestBody = ({
getComponent, getComponent,
getConfigs, getConfigs,
specSelectors, specSelectors,
fn,
contentType, contentType,
isExecute, isExecute,
specPath, specPath,
@@ -85,6 +86,7 @@ const RequestBody = ({
<td className="col parameters-col_description"> <td className="col parameters-col_description">
{isExecute ? {isExecute ?
<JsonSchemaForm <JsonSchemaForm
fn={fn}
dispatchInitialValue={!isFile} dispatchInitialValue={!isFile}
schema={prop} schema={prop}
getComponent={getComponent} getComponent={getComponent}
@@ -132,6 +134,7 @@ RequestBody.propTypes = {
requestBodyValue: ImPropTypes.orderedMap.isRequired, requestBodyValue: ImPropTypes.orderedMap.isRequired,
getComponent: PropTypes.func.isRequired, getComponent: PropTypes.func.isRequired,
getConfigs: PropTypes.func.isRequired, getConfigs: PropTypes.func.isRequired,
fn: PropTypes.object.isRequired,
specSelectors: PropTypes.object.isRequired, specSelectors: PropTypes.object.isRequired,
contentType: PropTypes.string, contentType: PropTypes.string,
isExecute: PropTypes.bool.isRequired, isExecute: PropTypes.bool.isRequired,