From 40e2097d425a9be6bdac6b8cd5636c84166bace2 Mon Sep 17 00:00:00 2001 From: samuel-sirven-bib Date: Fri, 5 Jul 2024 16:01:25 +0200 Subject: [PATCH 1/3] Fix Internal Server Error 500 for ValidationError - Change the middleware in responses.py for ValidationError to raise an HTTPUnprocessableEntity instead of a JsonHttpBadRequest --- app/api/v2/responses.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/api/v2/responses.py b/app/api/v2/responses.py index 278e4f07e..d1fc58c2a 100644 --- a/app/api/v2/responses.py +++ b/app/api/v2/responses.py @@ -1,5 +1,9 @@ +import json + from aiohttp import web from json import JSONDecodeError + +from aiohttp.web_exceptions import HTTPUnprocessableEntity from marshmallow.exceptions import ValidationError from app.api.v2 import errors @@ -51,9 +55,9 @@ async def apispec_request_validation_middleware(request, handler): ) except ValidationError as ex: # ex: List of objects sent when single object expected - raise JsonHttpBadRequest( - error='Error parsing JSON: Could not validate Schema', - details=str(ex) + formatted_message = json.dumps({"json": ex.messages}, indent=2) + raise HTTPUnprocessableEntity( + text=formatted_message ) except JSONDecodeError as ex: raise JsonHttpBadRequest( From cd1540cb35abc125c7014c1e623c4934a084d385 Mon Sep 17 00:00:00 2001 From: "P.S.i Coder" <82137307+psicoder85@users.noreply.github.com> Date: Wed, 24 Jul 2024 21:55:03 -0600 Subject: [PATCH 2/3] Update README.md Documentation update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e85fa2d9..a5e813263 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Refer to our [contributor documentation](CONTRIBUTING.md). ## Vulnerability Disclosures -Refer to our [vulnerability discolosure documentation](SECURITY.md) for submitting bugs. +Refer to our [Vulnerability Disclosure Documentation](SECURITY.md) for submitting bugs. ## Licensing From b93877dd881c8beb29557f917a2b13ad3f0cf013 Mon Sep 17 00:00:00 2001 From: Michael Kouremetis Date: Sat, 3 Aug 2024 11:29:25 -0400 Subject: [PATCH 3/3] Update stale.yml --- .github/workflows/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 782dac96e..2c99dfbfa 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -25,5 +25,5 @@ jobs: stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' exempt-issue-labels: 'feature,keep' - days-before-stale: 45 - days-before-close: 30 + days-before-stale: 60 + days-before-close: 60