rjsf-team/react-jsonschema-form

Boolean schema `false` is ignored

Geschlossen

#4.528 geöffnet am 17.03.2025

 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (2.136 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (13.175 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 3T 17h) (32 gemergte PRs in 30 T)

Beschreibung

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

Given the following schema:

{
  "type": "number",
  "if": {
    "const": 13
  },
  "then": false
}

Value 13 is a valid value.

Expected Behavior

In JSON Schema, false equals {"not": {}} link to spec

Thus, the schema above with value 13 should be invalid.

Steps To Reproduce

  1. Playground example
  2. Input value 13
  3. Click Submit

Expected: validation fails

Actual: Form submitted

If you click "Raw validate", you can see the AJV validation error.

Environment

Playground

Anything else?

Please note that if false is replaced with {"not": {}}, everything works as expected: playground

Contributor Guide