flask-validator icon indicating copy to clipboard operation
flask-validator copied to clipboard

Validator does not check nested values in lists and dicts

Open chumaumenze opened this issue 6 years ago • 2 comments

I have a payload, structured as follows:

{
    "alpha": {
        "bravo": {"charlie": "delta"},
        "whiskey": {"yankee": "zulu"}
    }
}

I am unable to validate items in alpha, i.e bravo and whiskey.


[
    {
        "alpha": {
            "bravo": "charlie"
        }
    },
    {
        "alpha": {
            "bravo": "charlie"
        }
    }
]

JSON Array raises an AttributeError and does not validate items in the list


{
    "alpha": {
        "bravo": "charlie",
        "victor": [1, 2, 3, {
            "a": {"b": "c"}
            }
        ],
        "whiskey": ["xray", 5.9, {"yankee": "zulu"}]
    }
}

Deeply nested values can not be validated.

chumaumenze avatar Dec 16 '19 22:12 chumaumenze

This is schema type of validation there is not support for schema validation but we can look in that direction also.

adekoder avatar Dec 17 '19 06:12 adekoder

You can checkout this package https://pypi.org/project/jsonschema/ for insights.

adekoder avatar Dec 17 '19 06:12 adekoder