These are chat archives for dry-rb/chat

13th
Apr 2017
Oskar Szrajer
@gotar
Apr 13 2017 10:03
yaks will work, I use yaks in one project
but it doesn't support JSON-API in 100%
Sergey Kukunin
@Kukunin
Apr 13 2017 11:28
Is there a way to build validation schema from dry-struct? Something like Dry::Validation.Schema(MyStruct.schema). I want to get all violation that prevents coercion data to MyStruct, and don't want to duplicate all attributes in a schema
Currently I do
def errors_for(attributes)
  MyStruct[attributes]
  nil
rescue => e
  e.to_s
end
but this gives an error by error
Sergey Kukunin
@Kukunin
Apr 13 2017 12:07
  • error is not formatted
Piotr Solnica
@solnic
Apr 13 2017 16:59
@Kukunin Dry::Validation.Schema(MyStruct) this should work, but it’s in alpha state
just try