validate function takes two arguments:
- the input data
- the schema to validate against
Schema Definition
Define your schema as a nested dictionary with these possible rules for each input:required(default:False): Marks the type as required.default(default:None): Default value if input is not provided.type(required): Expected input type.constraints(optional): for example, a lambda function returningtrueorfalse.
Example Usage
Testing
Save asyour_handler.py and test using:
- Command
- JSON