From 0abd7f51707477e62cfdfca3a6bd4ab638c93954 Mon Sep 17 00:00:00 2001 From: Adam Hopkins <127156771+simpat-adam@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:16:57 -0500 Subject: [PATCH] [ODS-5991] Improve error message (#840) * Improve error message * Fix Postman Tests --- ...dMembersWithMeaningfulDefaultsAttribute.cs | 2 +- ...uite ResponseTests.postman_collection.json | 2 +- ...gration Test Suite.postman_collection.json | 21 ++++++------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Application/EdFi.Ods.Common/Attributes/NoUnsuppliedRequiredMembersWithMeaningfulDefaultsAttribute.cs b/Application/EdFi.Ods.Common/Attributes/NoUnsuppliedRequiredMembersWithMeaningfulDefaultsAttribute.cs index 6cd66b656e..62ab127809 100644 --- a/Application/EdFi.Ods.Common/Attributes/NoUnsuppliedRequiredMembersWithMeaningfulDefaultsAttribute.cs +++ b/Application/EdFi.Ods.Common/Attributes/NoUnsuppliedRequiredMembersWithMeaningfulDefaultsAttribute.cs @@ -17,7 +17,7 @@ protected override ValidationResult IsValid(object value, ValidationContext vali { if(resource.GetUnassignedMemberNames().Any()) { - return new ValidationResult("Required value not explicitly assigned.", resource.GetUnassignedMemberNames()); + return new ValidationResult("Required", resource.GetUnassignedMemberNames()); } } diff --git a/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite ResponseTests.postman_collection.json b/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite ResponseTests.postman_collection.json index 351e7d3fdf..816dbeae65 100644 --- a/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite ResponseTests.postman_collection.json +++ b/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite ResponseTests.postman_collection.json @@ -5211,7 +5211,7 @@ "\r", "pm.test(\"Should return a message indicating that Validation failed. TotalInstructionalDays is not explicitly assigned\", () => {\r", " const responseItem = pm.response.json();\r", - " pm.expect(responseItem.modelState[\"request.TotalInstructionalDays\"][0]).to.include(\"Required value not explicitly assigned.\");\r", + " pm.expect(responseItem.modelState[\"request.TotalInstructionalDays\"][0]).to.include(\"Required\");\r", "});" ], "type": "text/javascript" diff --git a/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite.postman_collection.json b/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite.postman_collection.json index 57b98d5ef6..6747592ff0 100644 --- a/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite.postman_collection.json +++ b/Postman Test Suite/Ed-Fi ODS-API Integration Test Suite.postman_collection.json @@ -6449,9 +6449,7 @@ " return (message === expectedErrorMessage1);\r", " });\r", "\r", - " if (request && request.FiscalYear) {\r", - " pm.expect(responseItem.modelState[\"request.FiscalYear\"]).to.contain(\"Required value not explicitly assigned.\");\r", - " }\r", + " pm.expect(responseItem.modelState[\"request.FiscalYear\"][0]).to.equal(\"Required\");\r", "});" ], "type": "text/javascript" @@ -6528,9 +6526,7 @@ " return (message === expectedErrorMessage1);\r", " });\r", "\r", - " if (request && request.FiscalYear) {\r", - " pm.expect(responseItem.modelState[\"request.FiscalYear\"]).to.contain(\"Required value not explicitly assigned.\");\r", - " }\r", + " pm.expect(responseItem.modelState[\"request.FiscalYear\"][0]).to.equal(\"Required\");\r", "});" ], "type": "text/javascript" @@ -6607,9 +6603,7 @@ " return (message === expectedErrorMessage1);\r", " });\r", "\r", - " if (request && request.FiscalYear) {\r", - " pm.expect(responseItem.modelState[\"request.FiscalYear\"]).to.contain(\"Required value not explicitly assigned.\");\r", - " }\r", + " pm.expect(responseItem.modelState[\"request.FiscalYear\"][0]).to.equal(\"Required\");\r", "});" ], "type": "text/javascript" @@ -6957,13 +6951,10 @@ "\r", " const responseItem = pm.response.json();\r", " const expectedErrorMessage1 = \"The request is invalid.\";\r", - " pm.expect(responseItem.message).to.satisfy(function (message) {\r", - " return (message === expectedErrorMessage1);\r", - " });\r", + " pm.expect(responseItem.message).to.equal(expectedErrorMessage1);\r", + "\r", + " pm.expect(responseItem.modelState[\"request.FiscalYear\"][0]).to.equal(\"Required\");\r", "\r", - " if (request && request.FiscalYear) {\r", - " pm.expect(responseItem.modelState[\"request.FiscalYear\"]).to.contain(\"Required value not explicitly assigned.\");\r", - " }\r", "});" ], "type": "text/javascript"