These are chat archives for dry-rb/chat

23rd
Sep 2017
Arman H.
@arman-h
Sep 23 2017 00:07
Hi everyone, I have a usage question about dry-validation (if this channel is appropriate for this). I scoured the docs on the site, but can't seem to find an answer. I'd like to re-use a schema as a modular pieces within another schema, but without nesting. The documentation gives this as an example: required(:address).schema(AddressSchema), but this mounts AddressSchema into the address key. What I'm after is to mount one schema onto another so that their are merged, not nested (using the example in the documentation, I want street to sit directly on top of UserSchema, not scoped to address). Is this possible? I also tried using the custom predicate approach, but then I'm not able to define my own configuration/error messages on the custom predicate...
Pavel Penkov
@PavelPenkov
Sep 23 2017 03:44
@arman-h use UserSchema = Dry::Validation.Schema(AddressSchema) do ...