Fork me on GitHub
Ashkan Banitalebi19:08:33

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: and 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.


needs few locs of glue code, that's all

Ashkan Banitalebi20:08:13

Thanks @U055NJ5CC, that's very helpful. Since coercion is not my focus (mainly just validation), I think any of these options would do nicely.