fix(tio-params): disable empty values for required+enum booleans (#4615)

This commit is contained in:
kyle
2018-06-01 15:46:44 -07:00
committed by GitHub
parent 690e274e07
commit a51bf1ea3e
2 changed files with 52 additions and 3 deletions

View File

@@ -201,7 +201,7 @@ export class JsonSchema_boolean extends Component {
onEnumChange = (val) => this.props.onChange(val)
render() {
let { getComponent, value, errors, schema } = this.props
let { getComponent, value, errors, schema, required } = this.props
errors = errors.toJS ? errors.toJS() : []
const Select = getComponent("Select")
@@ -210,7 +210,7 @@ export class JsonSchema_boolean extends Component {
title={ errors.length ? errors : ""}
value={ String(value) }
allowedValues={ fromJS(schema.enum || ["true", "false"]) }
allowEmptyValue={ true }
allowEmptyValue={ !schema.enum || !required }
onChange={ this.onEnumChange }/>)
}
}