From 7644b8d104db221b47e7e20f0b7f317daa1ac6b1 Mon Sep 17 00:00:00 2001 From: Katie Stahl Date: Wed, 25 Sep 2024 11:33:07 -0400 Subject: [PATCH] feat: print all validation errors for fusion --- client/src/components/Pages/Summary/Invalid/Invalid.tsx | 7 +++---- client/src/components/Pages/Summary/Main/Summary.tsx | 8 +------- server/src/curfu/routers/validate.py | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/client/src/components/Pages/Summary/Invalid/Invalid.tsx b/client/src/components/Pages/Summary/Invalid/Invalid.tsx index 757bdf02..e1978ade 100644 --- a/client/src/components/Pages/Summary/Invalid/Invalid.tsx +++ b/client/src/components/Pages/Summary/Invalid/Invalid.tsx @@ -101,10 +101,9 @@ export const Invalid: React.FC = ({ const unknownError = ( <> - - We were unable to parse the validation failure for this fusion: - -
{validationErrors}
+ {validationErrors.map((error) => ( +
{error}
+ ))} ); diff --git a/client/src/components/Pages/Summary/Main/Summary.tsx b/client/src/components/Pages/Summary/Main/Summary.tsx index 14b0605e..976938ea 100644 --- a/client/src/components/Pages/Summary/Main/Summary.tsx +++ b/client/src/components/Pages/Summary/Main/Summary.tsx @@ -104,13 +104,7 @@ export const Summary: React.FC = ({ setVisibleTab }) => { // make request validateFusion(formattedFusion).then((response) => { if (response.warnings && response.warnings?.length > 0) { - if ( - validationErrors !== null && - JSON.stringify(response.warnings.sort()) !== - JSON.stringify(validationErrors.sort()) - ) { - setValidationErrors(response.warnings); - } + setValidationErrors(response.warnings); } else { setValidationErrors([]); setValidatedFusion( diff --git a/server/src/curfu/routers/validate.py b/server/src/curfu/routers/validate.py index 8ee72c54..38a85fec 100644 --- a/server/src/curfu/routers/validate.py +++ b/server/src/curfu/routers/validate.py @@ -32,7 +32,7 @@ def validate_fusion(request: Request, fusion: dict = Body()) -> ResponseDict: try: verified_fusion = fusor.fusion(**fusion) except FUSORParametersException as e: - response["warnings"] = [str(e)] + response["warnings"] = str(e).split("\n") else: response["fusion"] = verified_fusion return response