validate_dict
No overview available.
def validate_dict(
data: dict,
schema: dict
) - > bool
Validates that a dictionary contains all required keys and that their values match the expected data types. Use this to ensure incoming JSON payloads or configuration objects conform to a specific schema before processing.
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict | The dictionary object to be validated against the schema. |
| schema | dict | A mapping of required keys to their expected Python types (e.g., { 'id': int, 'name': str }). |
Returns
| Type | Description |
|---|---|
bool | Returns True if the dictionary is valid according to the schema, otherwise False. |