Json schema does not correctly validate an array of enums

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • ALL
    • Hide

      Given the following Json schema valiator applied to a collection:

      "properties": {
        "values": {
            "bsonType": "array",
            "items": {
              "bsonType": "string",
              "enum": [
                "one",
                "two",
                "three"
              ]
            },
            "minItems": 1,
            "uniqueItems": true
          }
      }
      

      I am still able to insert and also update a document with a 'values' property that contains an invalid value not included in the enum. For example if I insert or update a document via $set containing values ["one", "two", "three", "four"] it still passes validation.

      Show
      Given the following Json schema valiator applied to a collection: "properties": { "values": { "bsonType": "array", "items": { "bsonType": "string", "enum": [ "one", "two", "three" ] }, "minItems": 1, "uniqueItems": true } } I am still able to insert and also update a document with a 'values' property that contains an invalid value not included in the enum. For example if I insert or update a document via $set containing values ["one", "two", "three", "four"] it still passes validation.
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Using a Json schema containing a property with an enum keyword nested inside a items keyword should fail validation on encountering a value not included in the enum array. Currently it passes validation with invalid values included.

            Assignee:
            Kyle Suarez (Inactive)
            Reporter:
            Eric Tray
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: