From 22451ca806c879e4890ba7853cd5858d98c6b266 Mon Sep 17 00:00:00 2001 From: Eneko Illarramendi Date: Fri, 8 May 2020 21:10:04 +0200 Subject: [PATCH] fix: allow empty values (nullable) --- lnbits/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnbits/decorators.py b/lnbits/decorators.py index 31924f0..b8f61e1 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -35,7 +35,7 @@ def api_validate_post_request(*, schema: dict): return jsonify({"message": "Content-Type must be `application/json`."}), HTTPStatus.BAD_REQUEST v = Validator(schema) - g.data = {key: request.json[key] for key in schema.keys()} + g.data = {key: (request.json[key] if key in request.json else None) for key in schema.keys()} if not v.validate(g.data): return jsonify({"message": f"Errors in request data: {v.errors}"}), HTTPStatus.BAD_REQUEST