timriley on rich-component-dirs-config
Add component_dirs setting Rem… Scan component file for magic c… Make load_component easier to u… (compare)
timriley on rich-component-dirs-config
Fix wording Add Rubocop rule Clarify names Fixup naming and 4 more (compare)
@aditya01933 unless your array is actually accessed via a key i.e.
{
line_items: [
{line_item_id: 10, quantity: 5},
{line_item_id: 15, quantity: 3}
],
account_id: 5,
stripe_customer_id: '1103'
}
Then you could keep it all in one schema:
PurchaseSchema = Dry::Validation.Schema do
required(:line_items).each do
schema do
required(:line_item_id).filled
required(:quantity).filled
end
end
required(:account_id).filled
required(:stripe_customer_id).filled
end
PurchaseSchema = Dry::Validation(ApplicationSchema).Schema do
required(:line_items).each do
schema do
required(:line_item_id).filled
required(:quantity).filled
end
end
required(:account_id).filled
required(:stripe_customer_id).filled
end
If I am passing ApplicationSchema then it is generating error :
NoMethodError: undefined method `Validation' for Dry:Module
ok folks I’m done with logic/validation stuff…I’d appreciate if you could add this:
gem 'dry-validation', github: 'dry-rb/dry-validation', branch: 'master'
gem 'dry-types', github: 'dry-rb/dry-types', branch: 'master'
gem 'dry-struct', github: 'dry-rb/dry-struct', branch: 'master'
gem ‘dry-logic’, github: 'dry-rb/dry-logic', branch: 'master'
to your Gemfile and run your tests…
to_either
method