Skip to content

zen properties are being validated on any map #48

@KGOH

Description

@KGOH

For some reason zen tries to valiadate properties on all data coming in, this can be illustrated on a map:
I expect to get error that :zen/tags is not a valid key defined for my map, but I get no errors instead. After I can pass a hash set of symbols it is apparent that it is being validated by the 'zen/tags schema.

  (def ztx (zen.core/new-context {}))

  (zen.core/load-ns ztx '{:ns myns foo {:zen/tags #{zen/schema}
                                        :type zen/map
                                        :keys {:foo {:type zen/string}}}})

  (zen.core/validate ztx #{'myns/foo} {:zen/tags "foo"})
  ;; => {:errors [], :warnings [], :effects []}

  (zen.core/validate ztx #{'myns/foo} {:zen/tags #{'myns/foo}})
  ;; => {:errors
  ;;     [{:message
  ;;       "Expected symbol 'myns/foo tagged with '#{zen/tag}, but only #{zen/schema}",
  ;;       :type "symbol",
  ;;       :path [:zen/tags myns/foo],
  ;;       :schema [myns/foo :property :zen/tags :every myns/foo :tags]}],
  ;;     :warnings [],
  ;;     :effects []}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions