Skip to content

Merging registries produces child-error #780

Open
@bartkl

Description

@bartkl

As asked on the Slack channel, I was wondering if it is expected behavior to get an error when explicitly stating to use the default schemas registry:

(m/validate
  [:map
   [:x string?]]
  {:a 1})  ;; => false
(m/validate
  [:map {:registry (merge (m/default-schemas))}
   [:x string?]]
  {:a 1})
;; => clojure.lang.ExceptionInfo: :malli.core/child-error {:type :enum, :properties nil, :children nil, :min 1, :max nil}
;; {:type :malli.core/child-error, :message :malli.core/child-error, :data {:type :enum, :properties nil, :children nil, :min 1, :max nil}}

@ikitommi already pointed out that:

currently, the property-registry doesn’t allow IntoSchema instances, just Schemas. Original idea was that you can only present serializable things. Not sure if this is a good constraint, as you can anyway have non-serializable things in schemas, e.g [:string {:gen/gen …generator-function-here…}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions