1
votes

I wrote some simple dsl for validating a map, what it can do:

(ns foo.validator)

(defrule cannot-foo
  {:message "Value is %s. It cannot equal to string foo"}
  [value]
  (not (= value "foo")))

(defvalidator cannot-foo-validator
  :name [[cannot-foo]])

(cannot-foo-validator {:name "foo"}) ;; {:error <message here>}

Under the hood, it binds a function to a given symbol, in this is case cannot-foo and cannot-foo-validator.

How can I use it on clojurescript? I did exactly like in the clojurescript wiki:

(ns cljs.myfoo.core
  (:require-macros [foo.validator :as f]))

It compiles without warning, but if I start to use it:

(ns cljs.myfoo.core
  (:require-macros [foo.validator :as f]))

(cannot-foo-validator {:name "foo"})

When compiling, it complaints with No such namespace: foo.validator ......

1
Is foo included in your project.clj? - Trevor

1 Answers

0
votes

You need to make sure foo.validator is in a .clj or .cljc file.