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

document *options* #3

Open
daslu opened this issue Sep 6, 2024 · 6 comments
Open

document *options* #3

daslu opened this issue Sep 6, 2024 · 6 comments

Comments

@daslu
Copy link
Member

daslu commented Sep 6, 2024

No description provided.

@behrica
Copy link
Member

behrica commented Jan 22, 2025

@daslu
This is indeed important.

(-> plotly-example
    (kind/plotly {:style
                  {:width "300px"
                   :height "300px"}}))

A "kind" implementer need to know all allowed options for all kinds....

@behrica
Copy link
Member

behrica commented Jan 22, 2025

Maybe create a malli spec "per kind" in "kindly-render", at least for "manual inspection".

@daslu
Copy link
Member Author

daslu commented Jan 22, 2025

Good idea

@behrica
Copy link
Member

behrica commented Jan 22, 2025

To give you an idea:
Clojupyter currently supports this:

(defn malli-schema-for [kind]
  (m/schema
   (case kind
     :kind/fn  [:map {:closed true}  [:kindly/f {:optional true} fn?]]
     :kind/reagent  [:map {:closed true}  [:html/deps {:optional true} [:sequential keyword?]]]
     [:map {:closed true}])))

I can even generate documentation from it:

(require '[malli.experimental.describe :as med])
(med/describe [:map {:closed true}  [:html/deps {:optional true} [:sequential keyword?]]])
;;=> "map where {:html/deps (optional) -> <sequence of keyword>} with no other keys"

@behrica
Copy link
Member

behrica commented Jan 22, 2025

Or error message for users:

(kind/html "" {:invalid-option 1})
->
 [:div
  {:style "color:red"}
  "invalid options '{:invalid-option 1}' for kind :kind/html : {:invalid-option [\"disallowed key\"]}"]

@behrica
Copy link
Member

behrica commented Jan 23, 2025

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