Open KGOH opened 2 years ago
Zen symbol validation can not be reproduced with zen.validation or zen.v2-validation code: :zen/tags are only validated on load here: https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L138 https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L54-L55 https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L64
zen.validation
zen.v2-validation
:zen/tags
It looks like :zen/tags should be validated in zen.v2-validation/zen.validation and zen.store/validate-resource should just call validate function without handling :zen/tags explicitly
zen.store/validate-resource
validate
Steps to reproduce:
Prepare ztx:
(def my-zrc {'myns '{ns myns tag {:zen/tags #{zen/schema} :type zen/map :require #{:foo} :keys {:foo {:type zen/any}}} sym {:zen/tags #{tag}}}}) (def ztx (zen.core/new-context {:memory-store my-zrc})) (zen.core/load-ns ztx (get my-zrc 'myns))
(zen.core/errors ztx)
[{:type "require", :message ":foo is required", :path [:foo], :schema [myns/tag :require], :resource myns/sym} {:message "Expected symbol 'myns/tag tagged with '#{zen/tag}, but only #{zen/schema}", :type "symbol", :path [:zen/tags 0], :schema [myns/tag :property :zen/tags :every 0 :tags], :resource myns/sym}]
(zen.core/validate ztx #{'zen/schema} (zen.core/get-symbol ztx 'myns/sym))
{:errors [{:message "Expected symbol 'myns/tag tagged with '#{zen/tag}, but only #{zen/schema}", :type "symbol", :path [:zen/tags 0], :schema [zen/schema :property :zen/tags :every 0 :tags]}], :warnings [], :effects []}
Urgency: very low
Zen symbol validation can not be reproduced with
zen.validation
orzen.v2-validation
code::zen/tags
are only validated on load here: https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L138 https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L54-L55 https://github.com/zen-lang/zen/blob/19e6508e796b5c2c2d979bc12650b358a66aa5c7/src/zen/store.clj#L64It looks like :zen/tags should be validated in
zen.v2-validation
/zen.validation
andzen.store/validate-resource
should just callvalidate
function without handling:zen/tags
explicitlySteps to reproduce:
Prepare ztx:
(zen.core/errors ztx)
will show 2 errors(zen.core/validate ztx #{'zen/schema} (zen.core/get-symbol ztx 'myns/sym))
will show only one error:Urgency: very low