Skip to content

OneOf playground sample with maxLength generating wrong validation messageΒ #4427

@DharamveerYadav

Description

@DharamveerYadav

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

Using sample JSON for oneOf given on RJSF playground,

{
	"type": "object",
	"oneOf": [
		{
			"properties": {
				"lorem": {
					"type": "string",
					"maxLength": 50
				}
			},
			"required": [
				"lorem"
			]
		},
		{
			"properties": {
				"ipsum": {
					"type": "string",
					"maxLength": 50
				}
			},
			"required": [
				"ipsum"
			]
		}
	]
}

I have just inserted maxLength attribute to both of the properties to validate the max length.

validation message thrown is:
image

Expected Behavior

It should throw only : "must NOT have more than 50 characters".

Should not throw : "must match exactly one schema in oneOf".

Steps To Reproduce

try above mentioned JSON schema on rjsf playground and validate the form

Environment

- OS:
- Node:
- npm:

Anything else?

(https://rjsf-team.github.io/react-jsonschema-form/)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions