timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 (compare)
timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 (compare)
timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 (compare)
timriley on update-docsite-for-component-dirs
timriley on master
Reference dry-system without co… Use component_dirs config in do… Merge pull request #160 from dr… (compare)
timriley on update-docsite-for-component-dirs
Reference dry-system without co… Use component_dirs config in do… (compare)
timriley on master
Avoid freezing components Thes… Add dirs to load path so earlie… Extract Identifier; support mix… and 2 more (compare)
timriley on support-component-dirs-with-mixed-namespaces
class BarcodeSchema < Dry::Validation::Schema::Form
key(:barcode, &:filled?)
key(:job_number) { |v| v.none? | v.int? }
key(:sample_number) { |v| v.none? | v.int? }
rule(:barcode_only) do
rule(:barcode) ^ (rule(:job_number) | rule(:sample_number))
end
def self.messages
Dry::Validation::Messages.default.merge(
en: { errors: {
barcode_only: 'Can only enter data into barcode OR job/sample fields, not both'
}}
)
end
end
schema = MySchema.new
and schema.call(params)
{:barcode_only=>[["Can only enter data into barcode OR job/sample fields, not both"], "123"]}
rule(:barcode_only) do
rule(:barcode) ^ not(rule(:job_number) | rule(:sample_number))
end
not
true ^ true
=> false
true ^ false
=> true