Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing bug in :map schema #419

Closed
yuhan0 opened this issue Apr 14, 2021 · 0 comments
Closed

Parsing bug in :map schema #419

yuhan0 opened this issue Apr 14, 2021 · 0 comments

Comments

@yuhan0
Copy link

yuhan0 commented Apr 14, 2021

Using registry references to "composite" schemas in :map schemas and wrapping them in a vector without additional arguments causes an unexpected error.

(def reg
  {::foo [:tuple :int :int]
   ::bar :int})

(malli/schema
  [:map {:registry reg}
   [::foo]])
;; => Execution error (ExceptionInfo) at malli.impl.util/-fail! (util.cljc:16).
;;    :malli.core/invalid-schema {:schema [:tuple :int :int]}

Additional context:

It parses correctly if the reference is not wrapped in a vector, or if a map argument is included.

[:map {:registry reg}
 ::foo]

[:map {:registry reg}
 [::foo {}]]

Additionally, this only happens with "composite" schemas that take arguments like :tuple, :map-of, :<= etc.

The failing syntax from before works if the reference is a plain type-schema like :any, :string, :int etc.

[:map {:registry reg}
 [::bar]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant