Skip to content

coercion.malli does not work with humanized custom error messages #467

@ertugrulcetin

Description

@ertugrulcetin

After setting :options map, I could not get custom error messages. Is there any way to provide custom error messages for malli?

(reitit.coercion.malli/create
                       {;; set of keys to include in error messages
                        :error-keys #{:humanized}
                        ;; schema identity function (default: close all map schemas)
                        :compile mu/closed-schema
                        ;; strip-extra-keys (effects only predefined transformers)
                        :strip-extra-keys true
                        ;; add/set default values
                        :default-values true
                        ;; malli options
                        :options {:errors (-> me/default-errors
                                              (assoc ::m/missing-key {:error/message "required"}
                                                     ::m/extra-key {:error/message "invalid.attribute"}
                                                     'int? {:error/message "int"}
                                                     'pos-int? {:error/message "positive.int"}))}})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions