dry-bot on master
[devtools] update changelog.yml… [devtools] sync (compare)
solnic on master
Forward blocks passed to constr… Merge pull request #68 from min… (compare)
solnic on master
Docs: Removing Hash schema type… Merge pull request #404 from ga… (compare)
constructor_type :schemastyle :P )
optional(:group_ids, [:int]).value(:array?)but am having trouble figuring out how the element validation would work. Any advice?
Hi guys :) I am learning (and trying to implement) dry-transaction, I am going thru the Introduction and found this:
Each operation shouldn’t accumulate state, instead it should receive an input and return an output without causing any side-effects.
What do you mean by that? Especially this part
without causing any side-effects?
module ApiTokens class Create include Dry::Transaction step :validate step :persist step :regenerate_token def validate(input) validation = ApiTokenSchema.call(input) validation.success? ? Success(input) : Failure(validation.errors) end def persist(input) api_token = ApiToken.new(input) api_token.save ? Success(api_token) : Failure(api_token.errors) end def regenerate_token(api_token) api_token.regenerate_token! Success(api_token) end end end
type_specsoption in dry-validation. The documentation page exists and explains that the syntax is experimental, but as far as I can tell it is not linked from the menu nor any of the other documentation pages. Yet the documentation page for input pre-processing, which has its own spot in the menu, makes use of the feature without explaining how it works. And there seems to be many quite long standing issues related to the feature. Please note that my intention is not to complain nor asking that somebody looks into all the issues, I'm just curious whether this feature is "official" or not.