News for hackers. Stuff that matters.
Re:'New' Python modules of 2015 by bpicolo on Wednesday December 23, 2015 @12:30PM (#10784403)
Optional being an attribute of the key rather than the value is pretty bizarre to me, I've seen that patten a couple times. Feels like the wrong way to go about it
Re:'New' Python modules of 2015 by HeyImAlex on Wednesday December 23, 2015 @12:49PM (#10784517)
Think about it in terms of composability of validators; "having a key" is a property of the dict/object, not the value that is stored there. I feel your intuition, but experience says otherwise.
Re:'New' Python modules of 2015 by StavrosK on Wednesday December 23, 2015 @12:39PM (#10784463)
I see what you mean, but it's the key that's optional, not the value.
Re:'New' Python modules of 2015 by bpicolo on Wednesday December 23, 2015 @01:38PM (#10784823)
Ahh. That makes sense then. The value of the key being optional is indeed a different concept. Fwiw, this is one huge downside of Swagger APIs. Swagger supports the concept of optional keys but not optional values >.>

I have yet to find a validation library that supports all the sorts of things I expect it to. One place they tend to fail is the ways they can fulfill default values.

Say a field has an error and I want to just give it a default value when it's broken? That particular feature doesn't exist in any library i've found so far (for python) =/

Granted, this sort of blends into the usual "It's a validation library not a serialization library". But they all make a half-assed attempt at the other side in my experience.