Skip to content

Phrasing (s/int-in min max) #33

@Ramblurr

Description

@Ramblurr

Here is a simple example using spec's int-in

(defphraser :default
  [_ problem]
  problem)

(defphraser (s/int-in min max)
  [_ _ min max]
  (str "must be between " min " and " max))

(s/def ::total-widgets (s/int-in 1 32))

(phrase/phrase-first {} ::total-widgets 100)

This hits the default handler, and the problem map has the pred value

  :pred ( clojure.core/fn [ % ] ( clojure.spec.alpha/int-in-range? 1 32 % ) )

What's the proper way to phrase this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions