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

qualified keywords in :keys in mx/defn fails macro schema validator. #1028

Open
jasonjckn opened this issue Mar 30, 2024 · 2 comments
Open

Comments

@jasonjckn
Copy link
Contributor

The following code

(require '[malli.experimental :as m.x])
(m.x/defn foo [& {:keys [::opts]}] )

produces this error

  Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (30 frames hidden)

1. Unhandled clojure.lang.ExceptionInfo
   -- Error in registering a Function Schema ---------------- NO_SOURCE_FILE:268 --
   
   Function Var:
   
     usb.auxiliary.if.datomic.transact/foo (:clj)
   
   Function Schema:
   
     [:=> [:cat [:altn [:map [:map [:usb.auxiliary.if.datomic.transact/opts {:optional true}]]] [:args [:*
   [:alt [:cat [:= :usb.auxiliary.if.datomic.transact/opts] :usb.auxiliary.if.datomic.transact/opts] [:cat
   :any :any]]]]]] :any]
   
   More information:
   
     https://cljdoc.org/d/metosin/malli/CURRENT/doc/function-schemas
   
   --------------------------------------------------------------------------------

   {:type :malli.core/register-function-schema,
    :data
    {:ns usb.auxiliary.if.datomic.transact,
     :name foo,
     :schema
     [:=>
      [:cat
       [:altn
        [:map [:map [:usb.auxiliary.if.datomic.transact/opts {:optional true}]]]
        [:args
         [:*
          [:alt
           [:cat [:= :usb.auxiliary.if.datomic.transact/opts] :usb.auxiliary.if.datomic.transact/opts]
           [:cat :any :any]]]]]]
      :any],
     :data nil,
     :key :clj,
     :exception #error {
    :cause "-- Schema Creation Error --------------------------------- NO_SOURCE_FILE:268 --\n\nInvalid Schema\n\n  :usb.auxiliary.if.datomic.transact/opts\n\nMore information:\n\n  https://cljdoc.org/d/metosin/malli/CURRENT\n\n--------------------------------------------------------------------------------\n"
    :data {:type :malli.core/invalid-schema, :data {:schema :usb.auxiliary.if.datomic.transact/opts, :form :usb.auxiliary.if.datomic.transact/opts}}
    :via
    [{:type clojure.lang.ExceptionInfo
      :message "-- Schema Creation Error --------------------------------- NO_SOURCE_FILE:268 --\n\nInvalid Schema\n\n  :usb.auxiliary.if.datomic.transact/opts\n\nMore information:\n\n  https://cljdoc.org/d/metosin/malli/CURRENT\n\n--------------------------------------------------------------------------------\n"
      :data {:type :malli.core/invalid-schema, :data {:schema :usb.auxiliary.if.datomic.transact/opts, :form :usb.auxiliary.if.datomic.transact/opts}}
      :at [malli.dev.pretty$thrower$fn__17467 invoke "pretty.cljc" 168]}]
    :trace
    [[malli.dev.pretty$thrower$fn__17467 invoke "pretty.cljc" 168]
     [malli.dev$_capture_fail_BANG_$fn__41146$_fail_BANG___41147 invoke "dev.clj" 19]
     [clojure.lang.AFn applyToHelper "AFn.java" 156]
     [clojure.lang.AFn applyTo "AFn.java" 144]
     [clojure.lang.AFunction$1 doInvoke "AFunction.java" 33]
     [clojure.lang.RestFn invoke "RestFn.java" 424]
     [malli.core$_lookup_BANG_ invokeStatic "core.cljc" 271]
     [malli.core$_lookup_BANG_ invoke "core.cljc" 267]
     [malli.core$schema invokeStatic "core.cljc" 2050]
     [malli.core$schema invoke "core.cljc" 2028]
     [malli.core$_parse_entry$_schema__9124 invoke "core.cljc" 418]
     [malli.core$_parse_entry$_parse_ref_vector2__9132 invoke "core.cljc" 428]
     [malli.core$_parse_entry invokeStatic "core.cljc" 453]
     [malli.core$_parse_entry invoke "core.cljc" 410]
     [malli.core$_eager_entry_parser invokeStatic "core.cljc" 484]
     [malli.core$_eager_entry_parser invoke "core.cljc" 461]
     [malli.core$_create_entry_parser invokeStatic "core.cljc" 498]
     [malli.core$_create_entry_parser invoke "core.cljc" 495]
     [malli.core$_map_schema$reify__9451 _into_schema "core.cljc" 969]
     [malli.core$into_schema invokeStatic "core.cljc" 1986]
     [malli.core$into_schema invoke "core.cljc" 1977]
     [malli.core$schema invokeStatic "core.cljc" 2047]
     [malli.core$schema invoke "core.cljc" 2028]
     [malli.core$_parse_entry$_schema__9124 invoke "core.cljc" 418]
     [malli.core$_parse_entry$_parse_entry_else2__9134 invoke "core.cljc" 432]
     [malli.core$_parse_entry invokeStatic "core.cljc" 454]
     [malli.core$_parse_entry invoke "core.cljc" 410]
     [malli.core$_eager_entry_parser invokeStatic "core.cljc" 484]
     [malli.core$_eager_entry_parser invoke "core.cljc" 461]
     [malli.core$_create_entry_parser invokeStatic "core.cljc" 498]
     [malli.core$_create_entry_parser invoke "core.cljc" 495]
     [malli.core$_sequence_entry_schema$reify__10002 _into_schema "core.cljc" 1926]
     [malli.core$into_schema invokeStatic "core.cljc" 1986]
     [malli.core$into_schema invoke "core.cljc" 1977]
     [malli.core$schema invokeStatic "core.cljc" 2047]
     [malli.core$schema invoke "core.cljc" 2028]
     [malli.core$_sequence_schema$reify__9986$fn__9987 invoke "core.cljc" 1879]
     [malli.impl.util$_vmap invokeStatic "util.cljc" 29]

@jasonjckn jasonjckn changed the title qualified keywords in :keys in m.x/defn fails macro schema validator. qualified keywords in :keys in mx/defn fails macro schema validator. Mar 30, 2024
@NoahTheDuke
Copy link
Contributor

Is this legal clojure outside of mx/defn?

@jasonjckn
Copy link
Contributor Author

jasonjckn commented Mar 31, 2024

@NoahTheDuke

yes
image

if maintainer(s) accepts the issue, i can probably send the MR, i'm guessing it's pretty trivial fix.

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

2 participants