Your question is Validate JSON Against Schema. 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.
Netflix Keystone pipelines receive nested JSON payloads. Implement validate_json(data, schema) to determine whether a JSON-compatible value conforms to a supported schema.
data is a JSON-compatible Python value: None, bool, int, float, str, list, or dict. schema is a dictionary supporting these keywords:
type: one of null, boolean, number, integer, string, array, or object.enum: an array of permitted values. The data must equal one of them when present.properties: an object mapping property names to child schemas. These schemas are checked when the properties exist.required: an array of property names that must exist when the value is an object.items: a schema applied to every element when the value is an array.Return True if every applicable rule passes, otherwise return False. Object properties not listed in properties are allowed. A schema without a keyword imposes no restriction at that level.
def validate_json(data, schema):