Your question is Parse and Validate Nested JSON. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Commure clinical workflows exchange nested JSON event payloads. Implement a validator that determines whether a parsed JSON value conforms to a recursively defined schema.
Write validate_payload(value, schema):
value is a parsed JSON value represented by Python dictionaries, lists, strings, numbers, booleans, or None.schema is a dictionary with a required type field: object, array, string, number, boolean, or null.required, properties, and additionalProperties. If additionalProperties is false, keys absent from properties are invalid.items, which defines the schema for every element.enum; the value must equal one of the listed values when present.True only when the complete value satisfies every applicable rule. Return False otherwise.def validate_payload(value, schema):