Skip to content

Releases: coconutpalm/righttypes

Version 0.6.0

12 Apr 19:09
Compare
Choose a tag to compare

Summary

This release adds indexed, a small but useful feature for using RightTypes to create an in-memory database using Clojure. and fixes a few small bugs. Any breaking changes should be reported as bugs.

Indexed

Added indexed type constructor macro for constructing a map of maps, indexed by a some field in the maps. Here's some example usage, taken from the tests:

(def Person (T {:key keyword? :first-name string? :last-name string?}))
(def PersonDB (indexed Person :key)))

(tests
    "Happy path"
    (let [testee (PersonDB {:key :franken :first-name "Franken" :last-name "Stein"}
                           {:key :charlie :first-name "Charlie" :last-name "Brown"})]
      (-> testee :franken :last-name) := "Stein"
      (-> testee :charlie :last-name) := "Brown"))

(tests
    "Sadness: A field value fails type checking"
    (let [failure (PersonDB {:key :franken :first-name "Franken" :last-name :stein})]
      (-> failure :errors count)       := 1
      (-> failure :errors first :path) := '(:franken :last-name)
      (-> failure :errors first :msg)  := ":last-name:(:last-name string? :stein)"))

The failure messages could be improved somewhat, but I'm leaving that for a future release.

Bugs fixed

Just a bunch of small things. git log is your friend, if you care.

Version 0.5.0

11 Nov 01:54
0027c70
Compare
Choose a tag to compare

Version 0.5.0

Initial release. This code has been used in a single small production application.

As far as I know, all verifications pass and fail appropriately and as expected. I expect all of the main APIs to remain stable through the 0.x.x series at this point.

Known defects

Nested validations generate more verbose errors than are strictly necessary. I expect to address this in a future release.