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

Fix fn guard default configuration #1017

Closed
wants to merge 3 commits into from

Conversation

allentiak
Copy link

@allentiak allentiak commented Mar 11, 2024

Current default does not include the new fn guard.
Fixes #1018

@NoahTheDuke
Copy link
Contributor

Looks like your merge wasn't successful, so there are no changes present in the PR. Might want to rebase/rollback that commit.

@allentiak
Copy link
Author

allentiak commented Mar 12, 2024

@NoahTheDuke Thanks for the comment.

Yeah, it seems the Codespace in which I started working used an old commit as a baseline...
It seems I will have to start editing from scratch again...

I guess automatically generated web environments are not perfect?

BTW: @ikitommi in an earlier commit on this file (3b73f64) you did use the "guard" as a default parameter when validating.
Why did you change your mind later?

@ikitommi
Copy link
Member

not sure what is the queestion here. Here's how it works now:

(m/=> kikka6 [:=>
              [:cat :int]
              :int
              [:fn {:error/message "input should be output"}
               (fn [[[arg] ret]] (= arg ret))]])
(defn kikka6 [x] (inc x))

((requiring-resolve 'malli.dev/start!))

(kikka6 1)

gives:

-- Function Guard Error ----------------------------------------- Thread:1583 --

Function Var

  malli.core-test/kikka6

Guard arguments

  [[1] 2]

Guard Schema

  [:fn
   {:error/message "input should be output"}
   #object["malli.core_test$eval17032$fn__17034@1803b826"]]

Errors

  {:in [],
   :message "input should be output",
   :path [],
   :schema [:fn
            {:error/message "input should be output"}
            #object["malli.core_test$eval17032$fn__17034@1803b826"]],
   :value [[1] 2]}

More information

  https://cljdoc.org/d/metosin/malli/CURRENT/doc/function-schemas

--------------------------------------------------------------------------------

@allentiak
Copy link
Author

Hi,
Thanks for the message, @ikitommi
You're right: my bad.
Sorry for the misunderstanding.
Closing...

@allentiak allentiak closed this Mar 23, 2024
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

Successfully merging this pull request may close these issues.

function guard should be instrumented by default
3 participants