Skip to content

schemas with references ($ref) not working and always passing #16

@guillemdc

Description

@guillemdc

I have schemas that reference other Ids in the same schema and they always validate, even when they shouldn't.

For example this data:

{
"name": "Joe",
"toys": [{
    "name": "car",
    "price": 23
}]
}

will validate against this schema, but it shouldn't because the toy has no color.

{
    "kid": {
        "id": "kid",
        "required": ["name",
        "toys"],
        "properties": {
            "name": {
                "type": "string"
            },
            "toys": {
                "type": "array",
                "items": {
                    "$ref": "toy"
                }
            }
        }
    },
    "toy": {
        "id": "toy",
        "required": ["name",
        "price",
        "color"],
        "properties": {
            "name": {
                "type": "string"
            },
            "price": {
                "type": "integer"
            },
            "color": {
                "type": "string"
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions