Skip to content

Validation error with nested oneOf #105

Description

@sfeitosa

We are developing a tool to apply differential test on json-schema libraries.

We found a subtle error happening only with the LUA's jsonschema library.

We used the following schema:

{
  "type": "object",
  "properties": {
    "resources": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "params": {
                "type": "object",
                "additionalProperties": {
                  "oneOf": [
                    { "type": "array" },
                    { "type": "object" },
                    { "type": "string" }
                  ]
                }
              }
            }
          }
        ]
      }
    }
  }
}

And the following document:

{
  "resources": {
    "myBicepWithInvalidParams": {
      "params": {
        "param1": []
      }
    }
  }
}

With these, it was generated the following error message:

Invalid doc for schema aspire property "resources"
validation failed: failed to validate additional
property myBicepWithInvalidParams: value should match
only one schema, but matches none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions