Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect anyOf selected #34

Open
romancow opened this issue Jul 23, 2024 · 1 comment
Open

Incorrect anyOf selected #34

romancow opened this issue Jul 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@romancow
Copy link
Collaborator

In the example linked in webgme-taxonomy issue #226, the first anyOf value isn't selected properly.

@romancow romancow added the bug Something isn't working label Jul 23, 2024
@romancow
Copy link
Collaborator Author

Adding related example's schema and data here for reference.

Schema

{
  "type": "object",
  "properties": {
    "taxonomyTags": {
      "type": "array",
      "uniqueItems": true,
      "minItems": 1,
      "items": {
        "type": "object",
        "anyOf": [
          {
            "type": "object",
            "title": "OptionalTerm",
            "properties": {
              "Vocabulary": {
                "title": "Vocabulary",
                "type": "object",
                "properties": {
                  "OptionalTerm": {
                    "title": "OptionalTerm",
                    "type": "object",
                    "properties": {
                      "TextField": {
                        "title": "TextField",
                        "type": "string",
                        "default": "someDefault"
                      }
                    },
                    "required": [],
                    "additionalProperties": false
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "title": "Mandatory",
            "properties": {
              "Vocabulary": {
                "title": "Vocabulary",
                "type": "object",
                "properties": {
                  "Mandatory": {
                    "title": "Mandatory",
                    "type": "object",
                    "properties": {
                      "OptWithDefault": {
                        "title": "OptWithDefault",
                        "type": "string",
                        "default": "SomeDefault"
                      },
                      "SetField": {
                        "title": "SetField",
                        "type": "array",
                        "uniqueItems": true,
                        "items": {
                          "anyOf": [
                            {
                              "title": "C",
                              "type": "object",
                              "properties": {
                                "C": {
                                  "title": "C",
                                  "type": "object",
                                  "properties": {},
                                  "required": [],
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "title": "A",
                              "type": "object",
                              "properties": {
                                "A": {
                                  "title": "A",
                                  "type": "object",
                                  "properties": {},
                                  "required": [],
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "title": "B",
                              "type": "object",
                              "properties": {
                                "B": {
                                  "title": "B",
                                  "type": "object",
                                  "properties": {},
                                  "required": [],
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false
                            }
                          ],
                          "default": {
                            "C": {}
                          }
                        }
                      },
                      "OptField": {
                        "title": "OptField",
                        "type": "string"
                      }
                    },
                    "required": [
                      "SetField"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "title": "RecTerm",
            "properties": {
              "Vocabulary": {
                "title": "Vocabulary",
                "type": "object",
                "properties": {
                  "RecTerm": {
                    "title": "RecTerm",
                    "type": "object",
                    "properties": {
                      "IntegerField": {
                        "title": "IntegerField",
                        "type": "integer"
                      }
                    },
                    "required": [
                      "IntegerField"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        ]
      }
    }
  }
}

Data

{
  "taxonomyTags": [
    {
      "Vocabulary": {
        "Mandatory": {
          "OptWithDefault": "SomeDefault",
          "SetField": [],
          "OptField": null
        }
      }
    },
    {
      "Vocabulary": {
        "OptionalTerm": {
          "TextField": "someDefault"
        },
        "RecTerm": {
          "IntegerField": null
        }
      }
    }
  ]
}

@romancow romancow self-assigned this Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant