Skip to content

Commit

Permalink
add schema extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
macielti committed Nov 23, 2024
1 parent 5a3a015 commit b3d6038
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ of [keepachangelog.com](http://keepachangelog.com/).

## [Unreleased]

## [41.73.72] - 2024-11-23

### Added

- Added `LocalDateTimeWire` and `UuidWire` schema extensions.

## [41.72.72] - 2024-11-19

### Removed
Expand Down Expand Up @@ -1111,7 +1117,9 @@ of [keepachangelog.com](http://keepachangelog.com/).

- Add `loose-schema` function.

[Unreleased]: https://github.com/macielti/common-clj/comparev41.72.72...HEAD
[Unreleased]: https://github.com/macielti/common-clj/compare/v41.73.72...HEAD

[41.73.72]: https://github.com/macielti/common-clj/compare/v41.72.72...v41.73.72

[41.72.72]: https://github.com/macielti/common-clj/compare/v40.72.72...v41.72.72

Expand Down
9 changes: 5 additions & 4 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject net.clojars.macielti/common-clj "41.72.72"
(defproject net.clojars.macielti/common-clj "41.73.72"

:description "Just common Clojure code that I use across projects"

Expand All @@ -25,9 +25,10 @@
[amazonica "0.3.167"]
[diehard "0.11.12"]
[overtone/at-at "1.4.65"]
[commons-io/commons-io "2.17.0"]
[commons-io/commons-io "2.18.0"]
[org.clojure/tools.logging "1.3.0"]
[org.clojure/tools.reader "1.5.0"]]
[org.clojure/tools.reader "1.5.0"]
[danlentz/clj-uuid "0.2.0"]]

:profiles {:dev {:resource-paths ^:replace ["test/resources"]

Expand All @@ -37,7 +38,7 @@
[com.github.clojure-lsp/lein-clojure-lsp "1.4.15"]
[com.github.liquidz/antq "RELEASE"]]

:dependencies [[net.clojars.macielti/common-test-clj "1.1.1"]
:dependencies [[net.clojars.macielti/common-test-clj "3.1.2"]
[org.slf4j/slf4j-api "2.0.16"]
[ch.qos.logback/logback-classic "1.5.12"]
[net.clojars.macielti/service-component "2.4.2"]
Expand Down
13 changes: 11 additions & 2 deletions src/common_clj/schema/extensions.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
(ns common-clj.schema.extensions
(:require [schema.core :as s]))
(:require [schema.core :as s]
[clj-uuid]))

(s/defschema LocalDateWire
"Example: '2024-09-07'"
(s/constrained s/Str #(re-matches #"^\d{4}-\d{2}-\d{2}T\d{2}$" %)))
(s/constrained s/Str #(re-matches #"^\d{4}-\d{2}-\d{2}$" %)))

(s/defschema LocalDateTimeWire
"Example: '2024-11-21T04:56:24.605402'"
(s/constrained s/Str #(re-matches #"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}$" %)))

(s/defschema UuidWire
"Example: '9c97de3b-ac65-44b2-ba4f-b65f8778e514'"
(s/constrained s/Str clj-uuid/uuid-string?))

0 comments on commit b3d6038

Please sign in to comment.