From 2a150df22d0adab796837be4c4dfdbcd3f28b12d Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:17:34 +0100 Subject: [PATCH 01/35] add jsonista --- deps.edn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 58dcb4ae..769a6bf6 100644 --- a/deps.edn +++ b/deps.edn @@ -29,7 +29,8 @@ camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"} ring/ring {:mvn/version "1.10.0"} javax.servlet/servlet-api {:mvn/version "2.5"} - hiccup/hiccup {:mvn/version "2.0.0-RC2"}} + hiccup/hiccup {:mvn/version "2.0.0-RC2"} + metosin/jsonista {:mvn/version "0.3.8"}} :aliases {:dev From b045231c42768f97299ff25d945f093d580f0a84 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:17:44 +0100 Subject: [PATCH 02/35] remove data.json --- deps.edn | 1 - 1 file changed, 1 deletion(-) diff --git a/deps.edn b/deps.edn index 769a6bf6..ea703fe5 100644 --- a/deps.edn +++ b/deps.edn @@ -2,7 +2,6 @@ :deps {org.clojure/clojure {:mvn/version "1.11.1"} org.clojure/core.async {:mvn/version "1.5.648"} org.clojure/tools.cli {:mvn/version "1.0.206"} - org.clojure/data.json {:mvn/version "2.4.0"} org.clojure/data.xml {:mvn/version "0.0.8"} com.draines/postal {:mvn/version "2.0.5"} com.flexiana/tiny-rbac {:mvn/version "0.1.1"} From 1b73623a69a598b27a52672cd63051283ca8cb4b Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:26:09 +0100 Subject: [PATCH 03/35] add jsonista --- examples/acl/test/comments_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/acl/test/comments_test.clj b/examples/acl/test/comments_test.clj index 2ed8a694..1ba5a4f5 100644 --- a/examples/acl/test/comments_test.clj +++ b/examples/acl/test/comments_test.clj @@ -6,6 +6,7 @@ [clojure.test :refer [deftest is use-fixtures]] [helpers :refer [test_member test_admin]] + [jsonista.core :as j] [post-helpers :refer [init-db-with-two-posts all-post-ids]])) From ecac0cc15f9f0fc521dc2f2443074c0b3cce4b38 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:26:44 +0100 Subject: [PATCH 04/35] refactor read calls --- examples/acl/test/comments_test.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/acl/test/comments_test.clj b/examples/acl/test/comments_test.clj index 1ba5a4f5..e4969b9f 100644 --- a/examples/acl/test/comments_test.clj +++ b/examples/acl/test/comments_test.clj @@ -20,7 +20,7 @@ :content "Test comment on first post"}) (let [new-posts (-> (helpers/fetch "posts/comments" test_admin) :body - (read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :data :posts)] (is (= 1 (->> (filter #(#{first-id} (:posts/id %)) new-posts) @@ -37,7 +37,7 @@ [response] (-> response :body - (read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :data :comments)) From 45399ecff643e28f4154d2b1bf1759bfd54a1bca Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:26:52 +0100 Subject: [PATCH 05/35] remove data.json --- examples/acl/test/comments_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/acl/test/comments_test.clj b/examples/acl/test/comments_test.clj index e4969b9f..bded1c42 100644 --- a/examples/acl/test/comments_test.clj +++ b/examples/acl/test/comments_test.clj @@ -2,7 +2,6 @@ (:require [acl] [acl-fixture :refer [std-system-fixture]] - [clojure.data.json :refer [read-str]] [clojure.test :refer [deftest is use-fixtures]] [helpers :refer [test_member test_admin]] From 119f7ffebae6eb6274bc8b56a61536c2399be6da Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:28:02 +0100 Subject: [PATCH 06/35] add jsonista --- examples/acl/test/helpers.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/acl/test/helpers.clj b/examples/acl/test/helpers.clj index 41b49d48..8a5071cd 100644 --- a/examples/acl/test/helpers.clj +++ b/examples/acl/test/helpers.clj @@ -1,7 +1,8 @@ (ns helpers (:require [clj-http.client :refer [request]] - [clojure.data.json :refer [write-str]])) + [clojure.data.json :refer [write-str]] + [jsonista.core :as j])) (def test_member "611d7f8a-456d-4f3c-802d-4d869dcd89bf") (def test_admin "b651939c-96e6-4fbb-88fb-299e728e21c8") From 313f8436e2ebc3d1154ce8c9c22a23cb858435e9 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:28:30 +0100 Subject: [PATCH 07/35] refactor write calls --- examples/acl/test/helpers.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/acl/test/helpers.clj b/examples/acl/test/helpers.clj index 8a5071cd..4c7612f5 100644 --- a/examples/acl/test/helpers.clj +++ b/examples/acl/test/helpers.clj @@ -47,14 +47,14 @@ :headers {"Authorization" test_admin "Content-Type" "application/json;charset=utf-8"} :url (format "http://localhost:3333/%s" (name uri)) - :body (write-str content)})) + :body (j/write-value-as-string content)})) ([uri user content] (request {:unexceptional-status (constantly true) :method :put :headers {"Authorization" user "Content-Type" "application/json;charset=utf-8"} :url (format "http://localhost:3333/%s" (name uri)) - :body (write-str content)}))) + :body (j/write-value-as-string content)}))) (defn post [uri user id content] @@ -64,5 +64,5 @@ "Content-Type" "application/json;charset=utf-8"} :url (format "http://localhost:3333/%s" (name uri)) :query-params {:id id} - :body (write-str content)})) + :body (j/write-value-as-string content)})) From f85ccdd0ed12d920eacd17460b2a9a435bb0482d Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:28:58 +0100 Subject: [PATCH 08/35] add jsonista --- examples/jwt/test/integration_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/jwt/test/integration_test.clj b/examples/jwt/test/integration_test.clj index 6afca459..cb33f243 100644 --- a/examples/jwt/test/integration_test.clj +++ b/examples/jwt/test/integration_test.clj @@ -3,6 +3,7 @@ [clj-http.client :refer [request]] [clojure.data.json :as json] [clojure.test :refer [deftest is use-fixtures]] + [jsonista.core :as j] [jwt-fixture :refer [std-system-fixture]])) (use-fixtures :once std-system-fixture) From 227523afc9493edd1e0b0e8fc8b4ad6ad85b0349 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:29:28 +0100 Subject: [PATCH 09/35] refactor write calls --- examples/jwt/test/integration_test.clj | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/jwt/test/integration_test.clj b/examples/jwt/test/integration_test.clj index cb33f243..4f22f69e 100644 --- a/examples/jwt/test/integration_test.clj +++ b/examples/jwt/test/integration_test.clj @@ -20,8 +20,8 @@ (-> (request {:method :post :url "http://localhost:3333/login" :headers {"Content-Type" "application/json;charset=utf-8"} - :body (json/write-str {:email email - :password password})}) + :body (j/write-value-as-string {:email email + :password password})}) :body (json/read-str :key-fn keyword) :auth-token)) @@ -31,7 +31,7 @@ :unexceptional-status (constantly true) :url "http://localhost:3333/secret" :headers {"Content-Type" "application/json;charset=utf-8"} - :body (json/write-str {:hello "hello"})})] + :body (j/write-value-as-string {:hello "hello"})})] (is (= 401 (:status response))) (is (= "Signature could not be verified." (:body response))))) @@ -40,23 +40,23 @@ (deftest authorized-secret (let [auth-token (auth email password) - response (request {:method :post - :unexceptional-status (constantly true) - :url "http://localhost:3333/secret" - :headers (merge {"Content-Type" "application/json;charset=utf-8"} - (bearer auth-token)) - :body (json/write-str {:hello "hello"})})] + response (request {:method :post + :unexceptional-status (constantly true) + :url "http://localhost:3333/secret" + :headers (merge {"Content-Type" "application/json;charset=utf-8"} + (bearer auth-token)) + :body (j/write-value-as-string {:hello "hello"})})] (is (= 200 (:status response))) (is (= "Hello Xiana. request content: {:hello \"hello\"}" (:body response))))) (deftest refresh-token (let [auth-token (auth email password) - response (request {:method :post - :unexceptional-status (constantly true) - :url "http://localhost:3333/secret" - :headers (merge {"Content-Type" "application/json;charset=utf-8"} - (bearer auth-token)) - :body (json/write-str {:hello "hello"})}) + response (request {:method :post + :unexceptional-status (constantly true) + :url "http://localhost:3333/secret" + :headers (merge {"Content-Type" "application/json;charset=utf-8"} + (bearer auth-token)) + :body (j/write-value-as-string {:hello "hello"})}) new-token (request {:method :get :unexceptional-status (constantly true) :url "http://localhost:3333/token" From e40f9f466a70ad56399dc1879d4733baab3bd947 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:29:45 +0100 Subject: [PATCH 10/35] refactor read calls --- examples/jwt/test/integration_test.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/jwt/test/integration_test.clj b/examples/jwt/test/integration_test.clj index 4f22f69e..b48a98d9 100644 --- a/examples/jwt/test/integration_test.clj +++ b/examples/jwt/test/integration_test.clj @@ -23,7 +23,7 @@ :body (j/write-value-as-string {:email email :password password})}) :body - (json/read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :auth-token)) (deftest unauthorized-secret @@ -67,6 +67,6 @@ (is (= 200 (:status new-token))) (is (map? (xiana.jwt/verify-jwt :no-claims - (-> new-token :body (json/read-str :key-fn keyword) :auth-token) + (-> new-token :body (j/read-value j/keyword-keys-object-mapper) :auth-token) (get-in @jwt-fixture/test-system [:xiana/jwt :auth])))))) From defe479b69a52787794e282ff3252e4003bdaf56 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:29:54 +0100 Subject: [PATCH 11/35] remove data.json --- examples/jwt/test/integration_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/jwt/test/integration_test.clj b/examples/jwt/test/integration_test.clj index b48a98d9..cdfd2cf7 100644 --- a/examples/jwt/test/integration_test.clj +++ b/examples/jwt/test/integration_test.clj @@ -1,7 +1,6 @@ (ns integration-test (:require [clj-http.client :refer [request]] - [clojure.data.json :as json] [clojure.test :refer [deftest is use-fixtures]] [jsonista.core :as j] [jwt-fixture :refer [std-system-fixture]])) From 901fa291aecb1817c207199ce926ef8340edc6f8 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:30:06 +0100 Subject: [PATCH 12/35] add jsonista --- examples/sessions/src/backend/app/controllers/login.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sessions/src/backend/app/controllers/login.clj b/examples/sessions/src/backend/app/controllers/login.clj index 0b392fb1..aaae9e1f 100644 --- a/examples/sessions/src/backend/app/controllers/login.clj +++ b/examples/sessions/src/backend/app/controllers/login.clj @@ -1,6 +1,6 @@ (ns app.controllers.login (:require - [clojure.data.json :as json] + [jsonista.core :as j] [ring.util.request :refer [body-string]] [xiana.session :as session]) (:import From 668040b68013d4836e06f29e9303065737d306ac Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:30:40 +0100 Subject: [PATCH 13/35] refactor read calls --- examples/sessions/src/backend/app/controllers/login.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sessions/src/backend/app/controllers/login.clj b/examples/sessions/src/backend/app/controllers/login.clj index aaae9e1f..1efa7c05 100644 --- a/examples/sessions/src/backend/app/controllers/login.clj +++ b/examples/sessions/src/backend/app/controllers/login.clj @@ -28,7 +28,7 @@ [{request :request :as state}] (try (let [rbody (or (some-> request body-string - (json/read-str :key-fn keyword)) + (j/read-value j/keyword-keys-object-mapper)) (throw (ex-message "Missing body"))) user (find-user (:email rbody)) session-id (UUID/randomUUID) From 0fca13514913cff06a0a4436e97ea278fb1833af Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:30:47 +0100 Subject: [PATCH 14/35] refactor write calls --- examples/sessions/src/backend/app/controllers/login.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sessions/src/backend/app/controllers/login.clj b/examples/sessions/src/backend/app/controllers/login.clj index 1efa7c05..981772c5 100644 --- a/examples/sessions/src/backend/app/controllers/login.clj +++ b/examples/sessions/src/backend/app/controllers/login.clj @@ -41,7 +41,7 @@ :response {:status 200 :headers {"Content-Type" "application/json" "Session-id" (str session-id)} - :body (json/write-str (update session-data :session-id str))})) + :body (j/write-value-as-string (update session-data :session-id str))})) (assoc state :response {:status 401 :body "Incorrect credentials"}))) (catch Exception _ (missing-credentials state)))) From 3c80f0662894924fa0e8b43f3770934fed985df2 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:31:14 +0100 Subject: [PATCH 15/35] add jsonista --- examples/acl/test/post_helpers.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/acl/test/post_helpers.clj b/examples/acl/test/post_helpers.clj index 8fd10b51..81b3ae43 100644 --- a/examples/acl/test/post_helpers.clj +++ b/examples/acl/test/post_helpers.clj @@ -1,7 +1,8 @@ (ns post-helpers (:require [clojure.data.json :refer [read-str]] - [helpers])) + [helpers] + [jsonista.core :as j])) (defn init-db-with-two-posts [] From e90483a3a18d56636120075954e09ef846121d57 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:31:27 +0100 Subject: [PATCH 16/35] refactor read calls --- examples/acl/test/post_helpers.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/acl/test/post_helpers.clj b/examples/acl/test/post_helpers.clj index 81b3ae43..622885ed 100644 --- a/examples/acl/test/post_helpers.clj +++ b/examples/acl/test/post_helpers.clj @@ -13,7 +13,7 @@ (defn post-ids [body] (map :posts/id (-> body - (read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :data :posts))) @@ -26,6 +26,6 @@ (defn update-count [body] (-> body - (read-str :key-fn clojure.core/keyword) + (j/read-value j/keyword-keys-object-mapper) (get-in [:data :posts]) count)) From 8acd435046442c5a871b8a3fd4e69838f21addc5 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:31:56 +0100 Subject: [PATCH 17/35] remove data.json --- examples/acl/test/post_helpers.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/acl/test/post_helpers.clj b/examples/acl/test/post_helpers.clj index 622885ed..fe66b651 100644 --- a/examples/acl/test/post_helpers.clj +++ b/examples/acl/test/post_helpers.clj @@ -1,6 +1,5 @@ (ns post-helpers (:require - [clojure.data.json :refer [read-str]] [helpers] [jsonista.core :as j])) From ed95836d8a100a7d051f5e720269940a2deb72ff Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:32:07 +0100 Subject: [PATCH 18/35] add jsonista --- examples/acl/test/posts_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/acl/test/posts_test.clj b/examples/acl/test/posts_test.clj index a95a66d7..a1150ccc 100644 --- a/examples/acl/test/posts_test.clj +++ b/examples/acl/test/posts_test.clj @@ -12,6 +12,7 @@ test_member test_admin test_staff]] + [jsonista.core :as j] [post-helpers :refer [post-ids update-count init-db-with-two-posts From d3e2d921d233db279ec4613e7c7135459a9e51d5 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:32:27 +0100 Subject: [PATCH 19/35] refactor write calls --- examples/acl/test/posts_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/acl/test/posts_test.clj b/examples/acl/test/posts_test.clj index a1150ccc..d7104fdd 100644 --- a/examples/acl/test/posts_test.clj +++ b/examples/acl/test/posts_test.clj @@ -152,7 +152,7 @@ :headers {"Authorization" test_admin "Content-Type" "application/json;charset=utf-8"} :unexceptional-status (constantly true) - :body (json/write-str {:ids (butlast ids)}) + :body (j/write-value-as-string {:ids (butlast ids)}) :method :post} http/request :body From 0c7505e7a5331a50a698d131297f000fe31153f7 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:32:36 +0100 Subject: [PATCH 20/35] refactor read calls --- examples/acl/test/posts_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/acl/test/posts_test.clj b/examples/acl/test/posts_test.clj index d7104fdd..fa9ce609 100644 --- a/examples/acl/test/posts_test.clj +++ b/examples/acl/test/posts_test.clj @@ -169,7 +169,7 @@ :content "test comment on test post"}) result (-> (fetch "posts/comments" test_member) :body - (json/read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :data :posts first)] From dbbb6e1bbf4decf1b826450c7fa50a5498e49c3f Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:32:48 +0100 Subject: [PATCH 21/35] remove data.json --- examples/acl/test/posts_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/acl/test/posts_test.clj b/examples/acl/test/posts_test.clj index fa9ce609..2cd9eb1d 100644 --- a/examples/acl/test/posts_test.clj +++ b/examples/acl/test/posts_test.clj @@ -3,7 +3,6 @@ [acl] [acl-fixture] [clj-http.client :as http] - [clojure.data.json :as json] [clojure.test :refer [deftest is use-fixtures]] [helpers :refer [delete put From 6e2c8b239b862510a193e3e791d0fc232b23c874 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:32:56 +0100 Subject: [PATCH 22/35] add jsonista --- test/xiana/web_socket/router_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/xiana/web_socket/router_test.clj b/test/xiana/web_socket/router_test.clj index 4a020313..01fe0959 100644 --- a/test/xiana/web_socket/router_test.clj +++ b/test/xiana/web_socket/router_test.clj @@ -2,6 +2,7 @@ (:require [clojure.data.json :as json] [clojure.test :refer [deftest is]] + [jsonista.core :as j] [reitit.core :as r] [xiana.interceptor :as interceptors] [xiana.websockets :refer [router]])) From 06a6d51679369952b5fc781b6b577a9f6de8ccab Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:33:08 +0100 Subject: [PATCH 23/35] refactor write calls --- test/xiana/web_socket/router_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xiana/web_socket/router_test.clj b/test/xiana/web_socket/router_test.clj index 01fe0959..c3357376 100644 --- a/test/xiana/web_socket/router_test.clj +++ b/test/xiana/web_socket/router_test.clj @@ -30,7 +30,7 @@ (deftest router-test (let [string-action "/log-string" - json-action (json/write-str {:action :log-json}) + json-action (j/write-value-as-string {:action :log-json}) edn-action "{:action :log-edn}"] (is (= "Log was called via string" (-> (routing {:request-data From ff993a5bd167b8b329bdac18dbd0e95d94fb0886 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:33:18 +0100 Subject: [PATCH 24/35] remove data.json --- test/xiana/web_socket/router_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/test/xiana/web_socket/router_test.clj b/test/xiana/web_socket/router_test.clj index c3357376..84d7a508 100644 --- a/test/xiana/web_socket/router_test.clj +++ b/test/xiana/web_socket/router_test.clj @@ -1,6 +1,5 @@ (ns xiana.web-socket.router-test (:require - [clojure.data.json :as json] [clojure.test :refer [deftest is]] [jsonista.core :as j] [reitit.core :as r] From c462a801a554e1b121d57ec39b510c4dc781a511 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:33:58 +0100 Subject: [PATCH 25/35] add jsonista --- src/xiana/sse.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xiana/sse.clj b/src/xiana/sse.clj index 722e7fc6..d1cacd3b 100644 --- a/src/xiana/sse.clj +++ b/src/xiana/sse.clj @@ -3,7 +3,8 @@ [clojure.core.async :as async :refer ( Date: Thu, 14 Dec 2023 09:34:19 +0100 Subject: [PATCH 26/35] refactor write calls --- src/xiana/sse.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xiana/sse.clj b/src/xiana/sse.clj index d1cacd3b..1064f331 100644 --- a/src/xiana/sse.clj +++ b/src/xiana/sse.clj @@ -16,7 +16,7 @@ (def EOL "\n") (defn ->message [data] - (str "data: " (json/write-str data) EOL EOL)) + (str "data: " (j/write-value-as-string data) EOL EOL)) (defn- clients->channels [clients] @@ -48,7 +48,7 @@ session-id (get-in state [:session-data :session-id])] {:on-connect (fn [ch] (swap! clients update session-id (fnil conj #{}) ch) - (jetty/send! ch {:headers headers :body (json/write-str {})})) + (jetty/send! ch {:headers headers :body (j/write-value-as-string {})})) :on-text (fn [c m] (jetty/send! c m)) :on-close (fn [ch _status _reason] (swap! clients update session-id disj ch))})) From 78ada1b5428a47333d7bd2a2dfb479738861bc54 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:34:51 +0100 Subject: [PATCH 27/35] remove data.json --- src/xiana/sse.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xiana/sse.clj b/src/xiana/sse.clj index 1064f331..4a3d3efc 100644 --- a/src/xiana/sse.clj +++ b/src/xiana/sse.clj @@ -1,7 +1,6 @@ (ns xiana.sse (:require [clojure.core.async :as async :refer ( Date: Thu, 14 Dec 2023 09:35:01 +0100 Subject: [PATCH 28/35] add jsonista --- examples/acl/test/users_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/acl/test/users_test.clj b/examples/acl/test/users_test.clj index 9afe61a8..41eb42e3 100644 --- a/examples/acl/test/users_test.clj +++ b/examples/acl/test/users_test.clj @@ -9,6 +9,7 @@ post test_member test_admin]] + [jsonista.core :as j] [post-helpers])) (use-fixtures :once acl-fixture/std-system-fixture) From 400115f23c93da4619adbee0538f73e6cdaae2e8 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:35:18 +0100 Subject: [PATCH 29/35] refactor read calls --- examples/acl/test/users_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/acl/test/users_test.clj b/examples/acl/test/users_test.clj index 41eb42e3..1a406f32 100644 --- a/examples/acl/test/users_test.clj +++ b/examples/acl/test/users_test.clj @@ -18,7 +18,7 @@ [response] (-> response :body - (json/read-str :key-fn keyword) + (j/read-value j/keyword-keys-object-mapper) :data :users)) From 730e6c6c0af39c171af2d2a618b9b723ee2e9bbd Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:35:26 +0100 Subject: [PATCH 30/35] remove data.json --- examples/acl/test/users_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/acl/test/users_test.clj b/examples/acl/test/users_test.clj index 1a406f32..74ed3ded 100644 --- a/examples/acl/test/users_test.clj +++ b/examples/acl/test/users_test.clj @@ -1,7 +1,6 @@ (ns users-test (:require [acl-fixture] - [clojure.data.json :as json] [clojure.test :refer [deftest is use-fixtures]] [helpers :refer [delete put From 7f3256d4e792ca0a9c7ebac9cc358df918eabbe1 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:35:34 +0100 Subject: [PATCH 31/35] add jsonista --- src/xiana/websockets.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xiana/websockets.clj b/src/xiana/websockets.clj index e4c07b5e..711c3488 100644 --- a/src/xiana/websockets.clj +++ b/src/xiana/websockets.clj @@ -3,6 +3,7 @@ [clojure.data.json :refer [read-str]] [clojure.edn :as edn] [clojure.string :as str] + [jsonista.core :as j] [reitit.core :as r] [ring.adapter.jetty9 :as jetty] [taoensso.timbre :as log] From a4d103c3d627980474f07ac0fa570c36f7d8c3d2 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:35:49 +0100 Subject: [PATCH 32/35] refactor read calls --- src/xiana/websockets.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xiana/websockets.clj b/src/xiana/websockets.clj index 711c3488..6ff0cbe1 100644 --- a/src/xiana/websockets.clj +++ b/src/xiana/websockets.clj @@ -25,7 +25,7 @@ (defn json-> "JSON to 'uri', converts json string to map, extract :action key" [j] - (:action (read-str j :key-fn keyword))) + (:action (j/read-value j j/keyword-keys-object-mapper))) (defn probe-> [e] From 67d77d9e457a12ebf15c7643d2cda02154c25928 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:35:58 +0100 Subject: [PATCH 33/35] remove data.json --- src/xiana/websockets.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xiana/websockets.clj b/src/xiana/websockets.clj index 6ff0cbe1..afec8408 100644 --- a/src/xiana/websockets.clj +++ b/src/xiana/websockets.clj @@ -1,6 +1,5 @@ (ns xiana.websockets (:require - [clojure.data.json :refer [read-str]] [clojure.edn :as edn] [clojure.string :as str] [jsonista.core :as j] From 1cae3337d78ad993ad32c88d3798b4cb50f0a568 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:37:05 +0100 Subject: [PATCH 34/35] remove data.json --- examples/acl/test/helpers.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/acl/test/helpers.clj b/examples/acl/test/helpers.clj index 4c7612f5..b6cfb172 100644 --- a/examples/acl/test/helpers.clj +++ b/examples/acl/test/helpers.clj @@ -1,7 +1,6 @@ (ns helpers (:require [clj-http.client :refer [request]] - [clojure.data.json :refer [write-str]] [jsonista.core :as j])) (def test_member "611d7f8a-456d-4f3c-802d-4d869dcd89bf") From 91c1c59d08685acf73269314738f45368feabc34 Mon Sep 17 00:00:00 2001 From: Theodor Meresescu Date: Thu, 14 Dec 2023 09:38:24 +0100 Subject: [PATCH 35/35] run format alias --- src/xiana/sse.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xiana/sse.clj b/src/xiana/sse.clj index 4a3d3efc..562586f3 100644 --- a/src/xiana/sse.clj +++ b/src/xiana/sse.clj @@ -1,9 +1,9 @@ (ns xiana.sse (:require [clojure.core.async :as async :refer (