juxt / bidi

Bidirectional URI routing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some UUID parameters are not matched

xiongtx opened this issue · comments

Expected behavior

bidi.bidi/uuid should match all valid UUIDs.

Actual behavior

bidi.bidi/uuid does not match certain UUIDs, e.g. the null UUID "00000000-0000-0000-0000-000000000000".

This is because the UUID regexp does not cover all UUIDs, but (strangely) imposes certain conditions on the type of UUID it matches. See clj-uuid for a general UUID-matching regexp.

Steps to reproduce

(def routes
  ["/" {["foo/" [bidi.bidi/uuid :id]] identity}])

(bidi.bidi/match-route routes "/foo/00000000-0000-0000-0000-000000000000")
;; => nil

(bidi.bidi/match-route routes "/foo/4ee34246-dcb5-4424-872f-31c224d00c08")
;; => {:route-params {:id #uuid "4ee34246-dcb5-4424-872f-31c224d00c08"},
;;     :handler #function[clojure.core/identity]}

Version info

  • bidi: 2.0.16