flash-gordon on master
Remove unreachable method (compare)
flash-gordon on master
Remove Dry::Types.type_keys It… (compare)
flash-gordon on master
Remove unreachable code (compare)
flash-gordon on master
Coverage for function.rb (compare)
flash-gordon on fix-maybe-call-safe
flash-gordon on master
Fix behavior of Maybe#call_safe… Merge pull request #380 from dr… (compare)
flash-gordon on fix-maybe-call-safe
Fix behavior of Maybe#call_safe… (compare)
flash-gordon on fix-maybe-call-safe
Fix behavior of Maybe#call_safe… (compare)
flash-gordon on fix-maybe-try
flash-gordon on master
Fix behavior of Types::Maybe#try Merge pull request #379 from dr… (compare)
flash-gordon on master
Fix typo Merge pull request #67 from gru… (compare)
flash-gordon on fix-maybe-try
Fix behavior of Types::Maybe#try (compare)
flash-gordon on master
Lax coverage (compare)
Hi guys, I have some trouble using dry-validation. I am trying to ensure that some ids I receive from my API are actually valid records in my database. In my form I have this :
property sender_ids
required(:sender_ids) do
filled? & array?
end
rule(valid_senders: [:sender_ids]) do |sender_ids|
Contact.exists?(id: value(:sender_ids))
end
But it raises the following error :
POST /letters with valid data returns the new letter
Failure/Error:
rule(valid_senders: [:sender_ids]) do |sender_ids|
Contact.exists?(id: value(:sender_ids))
end
NoMethodError: undefined method `with' for false:FalseClass
# ./.gems/gems/dry-validation-0.10.4/lib/dry/validation/schema/value.rb:96:in `rule'
# ./app/forms/letter/create_form.rb:31:in `block in <class:CreateForm>’
Do you have any idea ?
optional(:attribute_name) { eql?('') | none? | (str? & format?(/\w+/) & max_size?(10)) }
MyScheme.call(attribute_name: 'some invalid value').messages
{:attribute_name=>["must be equal to or must be a string or is in invalid format or size cannot be greater than 10"]}
Dry::Validation::MessageCompiler
I guess it doesn't support any options for switching generating strategies...
|
(Or) is the only node in produced AST that gets converted to a non-array value
&
, >
or ^
my errors messages are not joined. This code is a problem for me - https://github.com/dry-rb/dry-validation/blob/master/lib/dry/validation/message.rb#L35 - and I have no idea how to solve it without patching
def my_predicate
return eql? || none? || ... #this is pseudo code
end
my_predicate: 'custom message'
optional(:attr) { my_predicate }
hi! I'm running into a struggle with dry-transaction and I wonder if it is something any of you have run into.
1)The interface expected is always in the form call(input)
but since we have been using dry-initializer a lot, our callable objects are initialized with the input, and called with call()
without any arguments.
I can wrap the registered methods so they get called correctly but seems a bit of an overhead. Step adapters don't really solve anything since they adapt the handling of the output but not the way the method is called.
Is there any way to streamline this? Has any of you felt this need before?
#call
-ing them once.
#call
is receives the variable input.
#call
on it many times over.
#call
method that does that to_either conversion for you
newbie here. I watched @timriley's Singapore presentation and really liked the functional-ity and separation of concerns. I'm looking for some convention to surround me as I get started with these new-to-me dry and rom capabilities. Something like a "click here to download Trailblazer with skeleton support for a Riley-like dry/rom app".Is there any getting-started resource like that? Maybe @fran-worley can recommend where someone new to both dry/rom and Trailblazer should start if they have no legacy app to evolve?
I'm really interested in the ROM Relations concept that allows architect/developers to work with objects that look like business objects rather than detailed database scaffolding because the kind of applications that I work on have complex object-with-object relationships and all relational database repositories eventually so pollute the network-graph business concepts that the business services often have to be simplified or be reduced in flexibility if the relational-model details are implemented in the business objects themselves. Therefore, the dry/rom architecture of separating out associations as proper objects, of separating out repository query handlers, of separating out functional dependency-injected command objects, from the business objects themselves is intoxicating.
true?
https://github.com/dry-rb/dry-logic/blob/bed90e00489e4c133499126428ce1dc0f7beb9f6/lib/dry/logic/predicates.rb#L173-L175