async def finish(self, token: str, payload=None): data = await extract_validation_token(token) if data is None: raise HTTPUnauthorized() action = data.get("v_task") if action in app_settings["auth_validation_tasks"]: if "schema" in app_settings["auth_validation_tasks"][action]: schema = app_settings["auth_validation_tasks"][action][ "schema"] try: jsonvalidate(instance=payload, schema=schema) except ValidationError as e: raise HTTPPreconditionFailed( content={ "reason": "json schema validation error", "message": e.message, "validator": e.validator, "validator_value": e.validator_value, "path": [i for i in e.path], "schema_path": [i for i in e.schema_path], "schema": schema, }) task = resolve_dotted_name( app_settings["auth_validation_tasks"][action]["executor"]) result = await task.run(data, payload) else: logger.error(f"Invalid task {action}") raise HTTPNotImplemented() await notify(ValidationEvent(data)) return result
def validate(self, object): try: jsonvalidate(object, schema) except ValidationError as e: raise AttributeError(e.message)
def check_schema(self): return jsonvalidate(self.license, self.schema)
def check_schema(self): return jsonvalidate(self.status, self.schema)