https://github.com/pez/guardrails-malli-mini
Using Guardrails with Malli, and the Guardrails registry from Malli
https://github.com/pez/guardrails-malli-mini
clojure clojurescript guardrails malli
Last synced: 3 months ago
JSON representation
Using Guardrails with Malli, and the Guardrails registry from Malli
- Host: GitHub
- URL: https://github.com/pez/guardrails-malli-mini
- Owner: PEZ
- Created: 2024-03-28T22:05:26.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-29T22:11:30.000Z (about 1 year ago)
- Last Synced: 2024-11-18T11:46:55.495Z (7 months ago)
- Topics: clojure, clojurescript, guardrails, malli
- Language: Clojure
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A Guardrails with Malli mini example
* [Guardrails](https://github.com/fulcrologic/guardrails): Efficient, hassle-free function call validation with a concise inline syntax for clojure.spec and Malli
* [Malli](https://github.com/metosin/malli): High-performance data-driven data specification library for Clojure/Script.This super mini [Clojure](https://clojure.org) + [ClojureScript](https://clojurescript.org) project demonstrates:
* How to use the declarative versions of `malli.util` transformation schemas with Guardrails
* ~~How to use the Guardrails registry with regular Malli validation~~
* ~~NB: **This only seems to work if Guardrails is enabled.** See note in the source code.~~
* A way to make Guardrails use a custom mutable Malli registry, as a way to share schemas between Guardrails and regular Malli validations.The relevant code is in ~~[src/main/guarded.cljc](src/main/guarded.cljc)~~ [src/main/registry.cljc](src/main/registry.cljc). And in [src/main/guarded2.cljc](src/main/guarded2.cljc) there's code to try in both the Clojure and the ClojureScript REPL. With or without Guardrails enabled.
NB: Guardrails is enabled via JVM opts in `deps.edn`. To disable it for shadow-cljs you need to remove the `:dev` alias from the `:deps` entry in `shadow-cljs`.
Happy guarded coding! ❤️