This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-17
Channels
- # announcements (8)
- # atom-editor (8)
- # aws (1)
- # babashka (96)
- # beginners (128)
- # calva (7)
- # cider (12)
- # cljsrn (1)
- # clojure (75)
- # clojure-europe (28)
- # clojure-hamburg (2)
- # clojure-italy (7)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojure-uk (13)
- # clojurescript (26)
- # conjure (2)
- # cursive (18)
- # data-science (7)
- # datalog (21)
- # datomic (9)
- # duct (15)
- # expound (29)
- # figwheel-main (14)
- # fulcro (59)
- # helix (4)
- # jobs (2)
- # kaocha (19)
- # leiningen (15)
- # luminus (4)
- # malli (57)
- # meander (2)
- # off-topic (2)
- # pathom (12)
- # pedestal (8)
- # re-frame (53)
- # reitit (9)
- # remote-jobs (1)
- # shadow-cljs (64)
- # spacemacs (1)
- # specter (2)
- # tools-deps (12)
- # tree-sitter (2)
- # vim (11)
- # xtdb (17)
Hi all, With the risk of this question being totally annoying and basic, what is the best practice for input validation in pedestal? I think I'll be using spec of each request input (the body) and I want for each API to have its own input validation. What I found, looking online was: https://github.com/oliyh/pedestal-api and https://github.com/metosin/reitit have some utilities for input/output validation and, mainly, coercion. However, I think I'd be better off writing my own interceptor(s) validating data. Am I missing something here? Thanks in advance. 🍻
I rolled my own interceptor for this, it's based on spec/conform
and expo.. re-invented the wheel a little bit since I know reitit has similar functionality.
@ashkan.dant3 spec doesn't support runtime value transformations, so if you want to roll your own solution, you should pick one of the spec coercion libs out there.
I believe you can just pick the reitit spec request & response coercion interceptors and use them with vanilla pedestal.
Thanks @U055NJ5CC, that's very helpful. Since coercion is not my focus (mainly just validation), I think any of these options would do nicely.