json-editor icon indicating copy to clipboard operation
json-editor copied to clipboard

if-then-else not working in allOf

Open Phillipip opened this issue 2 years ago • 4 comments

General information

  • json-editor version: 2.12.0

Expected behavior

should show only test1 or test2 and test3

Actual behavior

shows all properties the whole time

Steps to reproduce the behavior

Direct link to example: https://is.gd/8FVjkb

{
  "type": "object",
  "properties": {
    "country": {
      "default": "Test2",
      "type": "string",
      "enum": [
        "Test1",
        "Test2",
        "Test3"
      ]
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "country": {
            "const": "Test1"
          }
        }
      },
      "then": {
        "properties": {
          "test1": {
            "type": "string"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "country": {
            "enum": [
              "Test2",
              "Test3"
            ]
          }
        }
      },
      "then": {
        "properties": {
          "test2": {
            "type": "number"
          },
          "test3": {
            "type": "string"
          }
        }
      }
    }
  ]
}

Phillipip avatar Dec 05 '23 16:12 Phillipip

Yes In amazon sp-api create listing, json schema is:

amazon_shirt_schema.json

The properties is initially not required and is set to required in the allOf condition.

IT'S show errors : 231225184334

chatugpt avatar Dec 25 '23 10:12 chatugpt

any news?

Phillipip avatar Mar 04 '24 22:03 Phillipip

Sorry, we haven't found time to look into that, yet.

schmunk42 avatar Mar 05 '24 16:03 schmunk42