Skip to content

Commit

Permalink
fixup! fixup! set to 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Jan 25, 2024
1 parent 5848b54 commit 15e1cb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ merged with the internal registry at coerce time.

```clj
(s/def ::foo keyword?)
(c/coerce ::foo "bar" {::c/idents {::foo (fn [x opts] (str "keyword:" x))}}) -> "keyword:bar"
(c/coerce ::foo "bar" {:idents {::foo (fn [x opts] (str "keyword:" x))}}) -> "keyword:bar"
```

Coercers are functions of 2 args, the value, and the options coerce
Expand All @@ -60,7 +60,7 @@ The typical example would be :
```clj
(s/def ::foo (s/coll-of keyword?))
;; we'll namespace all keywords in that coll-of
(c/coerce ::foo ["a" "b"] {::c/idents {`keyword? (fn [x opts] (keyword "foo" x)})}) -> [foo/a foo/b]
(c/coerce ::foo ["a" "b"] {:idents {`keyword? (fn [x opts] (keyword "foo" x))}}) -> [foo/a foo/b]
```

You can specify multiple overrides per coerce call.
Expand All @@ -72,7 +72,7 @@ easily for instance generate open-api definitions using these.

```clj
(c/coerce ::foo (s/coll-of keyword?)
{::c/forms {`s/coll-of (fn [[_ spec]] (fn [x opts] (do-something-crazy-with-spec+the-value spec x opts)))}})
{:forms {`s/coll-of (fn [[_ spec]] (fn [x opts] (do-something-crazy-with-spec+the-value spec x opts)))}})
```

### Closed maps
Expand Down
4 changes: 2 additions & 2 deletions test/exoscale/coax_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
:unqualified 12
:sub {::infer-int 42}}))
(is (= (sc/coerce-structure {::or-example "321"}
{::sc/op sc/conform})
{:op sc/conform})
{::or-example [:int 321]}))

(defrecord SomeRec [a])
Expand Down Expand Up @@ -430,7 +430,7 @@
(is (= {::x :y/quux}
(sc/coerce ::mm
{::x "quux"}
{::sc/cache? false}))))
{:cache? false}))))

(def d :kw)
;; no vars in cljs
Expand Down

0 comments on commit 15e1cb8

Please sign in to comment.