Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The FieldValidation type doesn't support objects in schemas #2347

Closed
3 tasks done
Steffan-Ennis opened this issue Apr 27, 2021 · 1 comment
Closed
3 tasks done

The FieldValidation type doesn't support objects in schemas #2347

Steffan-Ennis opened this issue Apr 27, 2021 · 1 comment

Comments

@Steffan-Ennis
Copy link

Steffan-Ennis commented Apr 27, 2021

Prerequisites

Description

In index.d.ts the FieldValidation type does not support the schemas that have properties of type: 'object' with there
own properties keys

Steps to Reproduce

For the following schema

import * as RJSF from '@rjsf/core'

const mySchema = {
  'type': 'object',
  'properties': {
    'anotherObject': {
      'type': 'object',
      'properties': {
        'someField': {'type':'string'}
      }
    }
  }
}

function customValidate(formData:any, errors:RJSF.FormValidation):RJSF.FormValidation {
  if(!formData.anotherObject.someField){
    errors.anotherObject.someField.addError('This field has special validation rules')
  }

  return errors
}

Expected behaviour

Typescript should compile

Actual behaviour

There are typescript compilation errors

Version

Latest

@heath-freenome
Copy link
Member

Fixed in the v5 beta, see the 5.x migration guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants