This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new f821eadc46c kie-issues#954: Extended Services Runner erases data on 
dates with Decision Update (#2168)
f821eadc46c is described below

commit f821eadc46c6293db0ebbc99603b0f4caaf6fd5f
Author: Luiz João Motta <[email protected]>
AuthorDate: Thu Feb 22 11:14:25 2024 -0300

    kie-issues#954: Extended Services Runner erases data on dates with Decision 
Update (#2168)
---
 packages/dmn-runner/src/ajv.ts        |  2 +-
 packages/dmn-runner/src/jsonSchema.ts | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/packages/dmn-runner/src/ajv.ts b/packages/dmn-runner/src/ajv.ts
index a11e634c2f4..7d23ade1fda 100644
--- a/packages/dmn-runner/src/ajv.ts
+++ b/packages/dmn-runner/src/ajv.ts
@@ -50,7 +50,7 @@ import {
  * ajv: 'date-time'
  * dmn: 'date and time'
  */
-enum DmnAjvSchemaFormat {
+export enum DmnAjvSchemaFormat {
   DATE = "date",
   TIME = "time",
   DATE_TIME = "date-time",
diff --git a/packages/dmn-runner/src/jsonSchema.ts 
b/packages/dmn-runner/src/jsonSchema.ts
index 4b4e8252ecb..cac101e3a0a 100644
--- a/packages/dmn-runner/src/jsonSchema.ts
+++ b/packages/dmn-runner/src/jsonSchema.ts
@@ -18,7 +18,7 @@
  */
 
 import { JSON_SCHEMA_INPUT_SET_PATH, RECURSION_KEYWORD, RECURSION_REF_KEYWORD, 
X_DMN_TYPE_KEYWORD } from "./constants";
-import { ValidateFunction } from "./ajv";
+import { DmnAjvSchemaFormat, ValidateFunction } from "./ajv";
 import {
   ExtendedServicesDmnJsonSchema,
   DmnInputFieldProperties,
@@ -77,6 +77,17 @@ export function 
removeChangedPropertiesAndAdditionalProperties<T extends Validat
         return;
       }
 
+      // uniforms-patternfly saves the DateTimeField component value as a Date 
object and
+      // AJV handles data-time as a string, causing an error with keyword type.
+      // Also, the ajv.ErrorObject doesn't correctly type the parentSchema 
property
+      if (
+        error.keyword === "type" &&
+        (error.parentSchema as any)?.format === DmnAjvSchemaFormat.DATE_TIME &&
+        error.data instanceof Date
+      ) {
+        return;
+      }
+
       const pathList = error.dataPath
         .replace(/\['([^']+)'\]/g, "$1")
         .replace(/\[(\d+)\]/g, ".$1")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to