From 0149d03721649fb2ba10868f098511c649b6c736 Mon Sep 17 00:00:00 2001 From: Nikhil Shahi Date: Fri, 9 Sep 2022 01:46:18 -0500 Subject: [PATCH] (chore) update spec diff alert --- backend/src/services/spec/utils.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/services/spec/utils.ts b/backend/src/services/spec/utils.ts index 55f2d5f0..8195df01 100644 --- a/backend/src/services/spec/utils.ts +++ b/backend/src/services/spec/utils.ts @@ -126,12 +126,12 @@ export const generateAlertMessageFromReqErrors = ( let errorMessage = `${defaultErrorMessage} in request${ error["location"] ? ` ${error["location"]}` : "" }.` - let path = pathArray.length > 0 ? pathArray.join("/") : "" + let path = pathArray.length > 0 ? pathArray.join(".") : "" switch (error.keyword) { case "required": if (error.params?.missingProperty) { path = path - ? `${path}/${error.params.missingProperty}` + ? `${path}.${error.params.missingProperty}` : error.params.missingProperty } errorMessage = `Required property '${path}' is missing from request ${error["location"]}.` @@ -142,7 +142,7 @@ export const generateAlertMessageFromReqErrors = ( case "additionalProperties": if (error.params?.additionalProperty) { path = path - ? `${path}/${error.params.additionalProperty}` + ? `${path}.${error.params.additionalProperty}` : error.params.additionalProperty } errorMessage = @@ -152,7 +152,7 @@ export const generateAlertMessageFromReqErrors = ( case "unevaluatedProperties": if (error.params?.unevaluatedProperty) { path = path - ? `${path}/${error.params.unevaluatedProperty}` + ? `${path}.${error.params.unevaluatedProperty}` : error.params.unevaluatedProperty } errorMessage = @@ -172,7 +172,7 @@ export const generateAlertMessageFromReqErrors = ( if (!error["location"]) { errorMessage = `${defaultErrorMessage} in request.` } - const errorField = path?.split("/")[0] + const errorField = path?.split(".")[0] const tempPath = getPathToRequestLocation( parameters, error["location"] as Location, @@ -196,12 +196,12 @@ export const generateAlertMessageFromRespErrors = ( const defaultErrorMessage = error.message[0].toUpperCase() + error.message.slice(1) let errorMessage = `${defaultErrorMessage} in response body.` - let path = pathArray.length > 0 ? pathArray.join("/") : "" + let path = pathArray.length > 0 ? pathArray.join(".") : "" switch (error.keyword) { case "required": if (error.params?.missingProperty) { path = path - ? `${path}/${error.params.missingProperty}` + ? `${path}.${error.params.missingProperty}` : error.params.missingProperty } errorMessage = `Required property '${path}' is missing from response body.` @@ -212,7 +212,7 @@ export const generateAlertMessageFromRespErrors = ( case "additionalProperties": if (error.params?.additionalProperty) { path = path - ? `${path}/${error.params.additionalProperty}` + ? `${path}.${error.params.additionalProperty}` : error.params.additionalProperty } errorMessage = @@ -222,7 +222,7 @@ export const generateAlertMessageFromRespErrors = ( case "unevaluatedProperties": if (error.params?.unevaluatedProperty) { path = path - ? `${path}/${error.params.unevaluatedProperty}` + ? `${path}.${error.params.unevaluatedProperty}` : error.params.unevaluatedProperty } errorMessage =