You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dg...@apache.org on 2022/05/05 16:37:46 UTC

[unomi] branch fix-json-schema-issues created (now 291ed9c71)

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

dgriffon pushed a change to branch fix-json-schema-issues
in repository https://gitbox.apache.org/repos/asf/unomi.git


      at 291ed9c71 UNOMI-562 : add click event json schema, fix event collector deserialization

This branch includes the following new commits:

     new 291ed9c71 UNOMI-562 : add click event json schema, fix event collector deserialization

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[unomi] 01/01: UNOMI-562 : add click event json schema, fix event collector deserialization

Posted by dg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dgriffon pushed a commit to branch fix-json-schema-issues
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit 291ed9c7196cff6a77a622dc9c91ccae3ce5770e
Author: David Griffon <dg...@jahia.com>
AuthorDate: Thu May 5 18:37:38 2022 +0200

    UNOMI-562 : add click event json schema, fix event collector deserialization
---
 .../EventsCollectorRequestDeserializer.java        |  5 ++-
 .../META-INF/cxs/schemas/events/click.json         | 36 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/rest/src/main/java/org/apache/unomi/rest/deserializers/EventsCollectorRequestDeserializer.java b/rest/src/main/java/org/apache/unomi/rest/deserializers/EventsCollectorRequestDeserializer.java
index b544f2089..0f234192e 100644
--- a/rest/src/main/java/org/apache/unomi/rest/deserializers/EventsCollectorRequestDeserializer.java
+++ b/rest/src/main/java/org/apache/unomi/rest/deserializers/EventsCollectorRequestDeserializer.java
@@ -65,7 +65,10 @@ public class EventsCollectorRequestDeserializer extends StdDeserializer<EventsCo
             }
         }
         EventsCollectorRequest eventsCollectorRequest = new EventsCollectorRequest();
-        eventsCollectorRequest.setSessionId(node.get("sessionId").textValue());
+        final JsonNode sessionId = node.get("sessionId");
+        if (sessionId != null) {
+            eventsCollectorRequest.setSessionId(sessionId.textValue());
+        }
         eventsCollectorRequest.setEvents(filteredEvents);
         return eventsCollectorRequest;
     }
diff --git a/services/src/main/resources/META-INF/cxs/schemas/events/click.json b/services/src/main/resources/META-INF/cxs/schemas/events/click.json
new file mode 100644
index 000000000..6bc05c219
--- /dev/null
+++ b/services/src/main/resources/META-INF/cxs/schemas/events/click.json
@@ -0,0 +1,36 @@
+{
+  "$id": "https://unomi.apache.org/schemas/json/events/click/1-0-0",
+  "$schema": "https://json-schema.org/draft/2019-09/schema",
+  "self":{
+    "vendor":"org.apache.unomi",
+    "target" : "events",
+    "name": "click",
+    "format":"jsonschema",
+    "version":"1-0-0"
+  },
+  "title": "ViewEvent",
+  "type": "object",
+  "allOf": [{ "$ref": "https://unomi.apache.org/schemas/json/event/1-0-0" }],
+  "properties" : {
+    "properties" : {
+      "type" : "object",
+      "maxProperties": 50
+    },
+    "source" : {
+      "$ref" : "https://unomi.apache.org/schemas/json/customitems/page/1-0-0"
+    },
+    "target" : {
+      "properties": {
+        "scope": {
+          "type": "string"
+        },
+        "itemId": {
+          "type": "string"
+        },
+        "itemType": {
+          "type": "string"
+        }
+      }
+    }
+  }
+}
\ No newline at end of file