Skip to content

Commit

Permalink
[form-builder] Remove more validation cruft (fixes proptypes warning)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Oct 19, 2017
1 parent d47a25a commit 5f15276
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 1 addition & 4 deletions packages/@sanity/form-builder/src/FormBuilderInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export class FormBuilderInput extends React.Component {
static propTypes = {
value: PropTypes.any,
type: PropTypes.object.isRequired,
validation: PropTypes.object,
onChange: PropTypes.func.isRequired,
level: PropTypes.number.isRequired,
isRoot: PropTypes.bool
Expand All @@ -18,7 +17,6 @@ export class FormBuilderInput extends React.Component {
};

static defaultProps = {
validation: {messages: [], fields: {}},
isRoot: false
}

Expand All @@ -27,7 +25,7 @@ export class FormBuilderInput extends React.Component {
}

render() {
const {onChange, value, type, level, validation, isRoot, ...rest} = this.props
const {onChange, value, type, level, isRoot, ...rest} = this.props

const InputComponent = this.resolveInputComponent(type)
if (!InputComponent) {
Expand All @@ -42,7 +40,6 @@ export class FormBuilderInput extends React.Component {
value={value}
type={type}
onChange={type.readOnly ? NOOP : onChange}
validation={validation}
level={level}
{...rootProps}
/>
Expand Down
12 changes: 1 addition & 11 deletions packages/@sanity/form-builder/src/FormBuilderPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ const type = PropTypes.shape({
of: lazy(() => PropTypes.arrayOf(type))
})

const validation = {
fields: PropTypes.objectOf(lazy(() => PropTypes.shape(validation))),
messages: PropTypes.arrayOf(PropTypes.shape({
type: PropTypes.oneOf(['error', 'warning']),
id: PropTypes.string,
message: PropTypes.string
}))
}

const schema = PropTypes.shape({
name: PropTypes.string,
fields: PropTypes.arrayOf(type)
Expand All @@ -40,6 +31,5 @@ const schema = PropTypes.shape({
export default {
type,
field,
schema,
validation
schema
}

0 comments on commit 5f15276

Please sign in to comment.