Skip to content

Commit

Permalink
Ensure all map values are stringified.
Browse files Browse the repository at this point in the history
Fixed an issue where sometimes keywords where not being converted to strings. Closes #36

-=david=-
  • Loading branch information
dharrigan committed Feb 26, 2022
1 parent c3c13e8 commit a4ef992
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
restore-keys: ${{ env.APPLICATION }}-${{ hashFiles('deps.edn') }}

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ commits since the beginning of this repository.
### Added
### Removed

## [5.6.170]

### Changed

- Fixed an issue where sometimes keywords where not being converted to strings #36
- Bumped various libraries

## [5.6.169]

### Changed
Expand Down Expand Up @@ -243,8 +250,9 @@ commits since the beginning of this repository.
compatible with Sentry 10.0.1 and below. If you wish to use those
versions, please continue to use sentry-clj 1.7.30.

[Unreleased]: https://github.com/getsentry/sentry-clj/compare/5.6.169...HEAD
[5.6.169]: https://github.com/getsentry/sentry-clj/compare/5.5.166...5.6.169
[Unreleased]: https://github.com/getsentry/sentry-clj/compare/5.6.170...HEAD
[5.6.170]: https://github.com/getsentry/sentry-clj/compare/5.6.169...5.6.170
[5.6.169]: https://github.com/getsentry/sentry-clj/compare/5.6.166...5.6.169
[5.6.166]: https://github.com/getsentry/sentry-clj/compare/5.5.165...5.6.166
[5.5.165]: https://github.com/getsentry/sentry-clj/compare/5.5.164...5.5.165
[5.5.164]: https://github.com/getsentry/sentry-clj/compare/5.5.163...5.5.164
Expand Down
10 changes: 5 additions & 5 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
io.sentry/sentry {:mvn/version "5.6.1"}
ring/ring-core {:mvn/version "1.9.5"}}

:aliases {:build {:deps {io.github.seancorfield/build-clj {:git/tag "v0.6.7"
:git/sha "22c2d09"}}
:aliases {:build {:deps {io.github.seancorfield/build-clj {:git/tag "v0.7.0"
:git/sha "5d2cb60"}}
:ns-default scripts.build}

:test {:extra-paths ["test"]
:extra-deps {cheshire/cheshire {:mvn/version "5.10.2"}
com.github.seancorfield/expectations {:mvn/version "2.0.157"}
lambdaisland/kaocha {:mvn/version "1.62.993"}
lambdaisland/kaocha {:mvn/version "1.63.998"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
lambdaisland/kaocha-junit-xml {:mvn/version "0.0.76"}
orchestra/orchestra {:mvn/version "2021.01.01-1"}
org.clojure/test.check {:mvn/version "1.1.1"}}}

:antq {:replace-deps {com.github.liquidz/antq {:mvn/version "1.4.0"}
org.slf4j/slf4j-nop {:mvn/version "1.7.35"}}
:antq {:replace-deps {com.github.liquidz/antq {:mvn/version "1.5.1"}
org.slf4j/slf4j-nop {:mvn/version "1.7.36"}}
:exec-fn antq.tool/outdated
:exec-args {:directory ["."]
:skip ["pom"]
Expand Down
10 changes: 5 additions & 5 deletions examples/basic/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
;;
ch.qos.logback/logback-classic {:mvn/version "1.2.10"}
io.sentry/sentry {:mvn/version "5.6.1"}
io.sentry/sentry-clj {:mvn/version "5.6.169"}
io.sentry/sentry-clj {:mvn/version "5.6.170"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
org.clojure/tools.logging {:mvn/version "1.2.4"}
org.slf4j/jcl-over-slf4j {:mvn/version "1.7.35"}
org.slf4j/jul-to-slf4j {:mvn/version "1.7.35"}
org.slf4j/log4j-over-slf4j {:mvn/version "1.7.35"}
org.slf4j/slf4j-api {:mvn/version "1.7.35"}}}
org.slf4j/jcl-over-slf4j {:mvn/version "1.7.36"}
org.slf4j/jul-to-slf4j {:mvn/version "1.7.36"}
org.slf4j/log4j-over-slf4j {:mvn/version "1.7.36"}
org.slf4j/slf4j-api {:mvn/version "1.7.36"}}}
8 changes: 4 additions & 4 deletions examples/uncaught/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
io.sentry/sentry-clj {:mvn/version "5.6.169"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
org.clojure/tools.logging {:mvn/version "1.2.4"}
org.slf4j/jcl-over-slf4j {:mvn/version "1.7.35"}
org.slf4j/jul-to-slf4j {:mvn/version "1.7.35"}
org.slf4j/log4j-over-slf4j {:mvn/version "1.7.35"}
org.slf4j/slf4j-api {:mvn/version "1.7.35"}}}
org.slf4j/jcl-over-slf4j {:mvn/version "1.7.36"}
org.slf4j/jul-to-slf4j {:mvn/version "1.7.36"}
org.slf4j/log4j-over-slf4j {:mvn/version "1.7.36"}
org.slf4j/slf4j-api {:mvn/version "1.7.36"}}}
3 changes: 2 additions & 1 deletion src/sentry_clj/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
on walk/stringify-keys."
[m]
(let [f (fn [[k v]]
(let [k (if (keyword? k) (name k) k)]
(let [k (if (keyword? k) (name k) k)
v (if (keyword? v) (name v) v)]
(if (map? v) [k (HashMap. ^Map v)] [k v])))]
(walk/postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))

Expand Down
7 changes: 7 additions & 0 deletions test/sentry_clj/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
(expect SentryLevel/ERROR (#'sut/keyword->level :error))
(expect SentryLevel/FATAL (#'sut/keyword->level :fatal))))

(defexpect java-util-hashmappify-vals-tests
(expecting
"everything is a string"
(expect {"a" "b"} (#'sut/java-util-hashmappify-vals {:a :b}))
(expect {"a" "b" {"c" "d"} (#'sut/java-util-hashmappify-vals {:a {:b {:c :d}}})})
(expect {"var1" "val1" "var2" {"a" {"b" {"c" {"d" {"e" "f"} "g" "h"}}}}} (#'sut/java-util-hashmappify-vals {:var1 "val1" :var2 {:a {:b {:c {:d {:e :f} :g :h}}}}}))))

(def event
{:event-id (UUID/fromString "4c4fbea9-57a7-4c99-808d-2284306e6c98")
:message {:message "ok" :params ["foo" "bar"]}
Expand Down

0 comments on commit a4ef992

Please sign in to comment.