dry-rb / dry-transaction

Business transaction DSL
http://dry-rb.org/gems/dry-transaction
MIT License
468 stars 55 forks source link

Question: Operation input validation #111

Closed FunkyloverOne closed 6 years ago

FunkyloverOne commented 6 years ago

If I want to validate some separate operation input... First of all, should I actually do it? :) If so, then, I guess it would be consistent to use so dry-validation schema for it.

So if it is only a validation for this particular operation, maybe it's right place to define it directly inside operation class, and than use it in some private method called validate_input for example, and call is at the beginning of call method... But i'm not sure it is "legit".

I'm only starting learning dry-rb, so I'm trying to better understand how it meant to be used. BTW, maybe it would be good to have some sort of FAQ for questions like this.

FunkyloverOne commented 6 years ago

I guess that operations must be reused only inside Transactions, which should already include some other validate step, which will make sure that operation will get valid input. E.g. I must assume that operations will be always receiving only valid input.

BTW, should I use dry-validation for that validate step? (I guess yes, of course :D)

FunkyloverOne commented 6 years ago

OK, I'm closing this issue, seems like I've already answered my question, and now I know that you guys are having forums for stuff like that :+1: