From cebafefebe671a008e61807f5a6d970a4f3ae98b Mon Sep 17 00:00:00 2001 From: Thiyanwso2 <65483741+Thiyanwso2@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:06:08 +0530 Subject: [PATCH] Improve custom validation message for array constraints (#93) * Issue: wso2-enterprise/open-healthcare#1664 --- .../src/main/resources/templates/fhir_resource.vm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/native/fhir-to-bal-lib/src/main/resources/templates/fhir_resource.vm b/native/fhir-to-bal-lib/src/main/resources/templates/fhir_resource.vm index 5a0aa26..76b1fc7 100644 --- a/native/fhir-to-bal-lib/src/main/resources/templates/fhir_resource.vm +++ b/native/fhir-to-bal-lib/src/main/resources/templates/fhir_resource.vm @@ -88,14 +88,14 @@ public type $util.resolveSpecialCharacters($resourceName) record {| #if( $element.getMin() == $min ) minLength: { value: $min$separator - message: "This field must be an array containing at least one item." + message: "Validation failed for $.$element.getPath() constraint. This field must be an array containing at least one item." }#if( $element.getMax() == $max )$separator#end #end #if( $element.getMax() == $max ) maxLength: { value: $max$separator - message: "This field must be an array containing at most one item." + message: "Validation failed for $.$element.getPath() constraint. This field must be an array containing at most one item." } #end } @@ -163,14 +163,14 @@ public type $util.resolveSpecialCharacters($extendedElement.getTypeName()) recor #if( $childElement.getMin() == $min ) minLength: { value: $min$separator - message: "This field must be an array containing at least one item." + message: "Validation failed for $.$childElement.getPath() constraint. This field must be an array containing at least one item." }#if( $childElement.getMax() == $max )$separator#end #end #if( $childElement.getMax() == $max ) maxLength: { value: $max$separator - message: "This field must be an array containing at most one item." + message: "Validation failed for $.$childElement.getPath() constraint. This field must be an array containing at most one item." } #end }