Skip to content

oneOf dont properly select the const value  #1421

@rmonnerat

Description

@rmonnerat

General information

  • json-editor version: (from the example)

Expected behavior

I noticed that the oneOf, don't exactly behave like I expect, in my understanding the example should use const value, once I update the select field and not display the input.

It should give me something this when by me changing to "Fifteen":

{
"test-runner": 15
}

Actual behavior

The select field isn't exactly taken in consideration, in the end, I need to input some value and either input 6 or 15, makes the validation satisfied.

Steps to reproduce the behavior

Direct Link to example

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "test-runner": {
      "type": "number",
      "oneOf": [
        {
          "type": "number",
          "const": 6,
          "title": "Six"
        },
        {
          "type": "number",
          "const": 15,
          "title": "Fifteen"
        }
      ]
    }
  }
}

/cc @navytux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions