rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.1k stars 2.18k forks source link

Warning: React does not recognize the `errorSchema` and Invalid DOM property `autocomplete`. #4134

Open brianlaw033 opened 5 months ago

brianlaw033 commented 5 months ago

Prerequisites

What theme are you using?

mui

Version

5.17.1

Current Behavior

Warning: React does not recognize the 'errorSchema' prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase 'errorschema' instead. If you accidentally passed it from a parent component, remove it from the DOM element.

Warning: Invalid DOM property 'autocomplete'. Did you mean 'autoComplete'?

I am getting these warnings when using Form imported from "@rjsf/mui" when having anyOf or oneOf with type object

Sample Schema

SomeSchema:
  type: object
  properties: 
     someProp:
        type: object
        anyOf:
          - properties:
               a:
                 type: string
          - properties:
               b:
                 type: string

Expected Behavior

No warnings, like using Normal Form from "@rjsf/core"

Steps To Reproduce

import Form from "@rjsf/mui"

<Form
    validator={validator}
    schema={{
        "title": "Location",
        "type": "object",
        "additionalProperties": true,
        "anyOf": [
            {
            "title": "City",
            "properties": {
                "city": {
                "type": "string"
                }
            },
            },
            {
            "title": "Coordinates",
            "properties": {
                "lat": {
                "type": "number"
                },
                "lon": {
                "type": "number"
                }
            },
            }
        ]
    }}
/>

Environment

- OS:
- Node:
- npm:

Anything else?

Screenshot 2024-03-18 at 17 43 46 Screenshot 2024-03-18 at 17 43 30
heath-freenome commented 5 months ago

Ah, we are spreading in the @rjsf/mui theme, and clearly we aren't removing those two properly. I'll push a fix and soon.

thaikoh commented 1 month ago

Facing exactly same issue with version 5.19.4. Seems bug was fixed in 5.18.0?

Warning: React does not recognize the `errorSchema` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `errorschema` instead. If you accidentally passed it from a parent component, remove it from the DOM element.\
Warning: Invalid DOM property `autocomplete`. Did you mean `autoComplete`?
heath-freenome commented 1 month ago

@thaikoh Can you provide an example using the a shared playground link that highlights this. Thanks!