Middleware support for different use cases of malli-forms
Middleware support for different use cases of malli-forms
(remove-empty-params handler)
Middleware that removes entirely any kv pairs that come from a form with an empty string as value. This should occur before unnesting params, as it becomes very difficult to track down empty strings in potentially deeply- nested data structures.
Middleware that removes entirely any kv pairs that come from a form with an empty string as value. This should occur before unnesting params, as it becomes very difficult to track down empty strings in potentially deeply- nested data structures.
(schema-endpoint handler schema)
(schema-endpoint handler schema options)
(schema-endpoint handler schema placeholder options)
Middleware that takes a schema and an optional map of malli options, wrapping a handler to render a form for the schema on GET requests, and to validate the input on POST, re-rendering the form with any validation errors, or passing the validated input to the handler function under the key ::mf/value, and the full result of parsing under ::mf/result.
Assumes you have upstream logic to handle wrapping a response with a hiccup body, and rendering appropriately.
See the schema definition of :malli-forms/options for specific keys that can be provided to control the behavior of malli-forms. Of course other keys for malli can also be passed here.
Middleware that takes a schema and an optional map of malli options, wrapping a handler to render a form for the schema on GET requests, and to validate the input on POST, re-rendering the form with any validation errors, or passing the validated input to the handler function under the key ::mf/value, and the full result of parsing under ::mf/result. Assumes you have upstream logic to handle wrapping a response with a hiccup body, and rendering appropriately. See the schema definition of :malli-forms/options for specific keys that can be provided to control the behavior of malli-forms. Of course other keys for malli can also be passed here.
Middleware in the data-driven style for reitit. Mounts schema-endpoint, detecting ::mf/schema and other matching namespaced keys from the route config.
Middleware in the data-driven style for reitit. Mounts schema-endpoint, detecting ::mf/schema and other matching namespaced keys from the route config.
(stub-handler {:malli-forms/keys [result value] :as req})
Not middleware. Use with schema-endpoint middleware to generate a simple page for inspecting output of handle-submit.
Not middleware. Use with schema-endpoint middleware to generate a simple page for inspecting output of handle-submit.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close