Skip to content

Add support for unevaluatedProperties for more efficient useage of allOf schemas #907

@fulstadev

Description

@fulstadev

When you have an allOf JSON schema of two objects with the unevaluatedProperties property, let's say:

{
    "type": "object",
    "unevaluatedProperties" : false,
    "allOf": [
        {
            "type": "object",
            "properties": {
                "hello" : {
                    "type" : "string"
                }
            },
            "required" : ["hello"]
        },
        {
            "type": "object",
            "properties": {
                "world": {
                    "type" : "string"
                }
            },
            "required" : ["world"]
        }
    ]
}

The validator should treat the validation equivalently to:

{
    "type": "object",
    "properties": {
        "hello" : {
            "type" : "string"
        },
        "world": {
            "type" : "string"
        }
    },
    "additionalProperties" : false,
    "required" : ["hello","world"]
}

Some tests on my side seem to ignore it. If you submit an object with additional properties (other than hello and world), validation does not fail as expected.

I suppose that the unevaluatedProperties thing is from a more recent draft, but it has been introduced for a reason and makes the usage of the very core allOf feature much more efficient, as it effectively allows you to reuse object schemas defined throughout the project in a much stricter way.

Do you think that it's possible to introduce this keyword ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions