Skip to content

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

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"
            }
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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