Dry-validation with struct sum type

Dry::Validation.load_extensions(:struct)

MyStructSumType = MyStructA | MyStructB

Dry::Validation.Params do
required(:foo).filled(MyStructSumType)
end

/bundle/gems/dry-types-0.13.2/lib/dry/types/sum.rb:124:in to_ast': undefined methodto_ast’ for #Class:0x0000557d9681a588

Is this meant to be supported?

Nope. This is something nice to have. You can probably file an issue to the dry-v repo and mark it as a feature request but I don’t know how soon it’s gonna be implemented given the current backlog is quite massive already :confused:

We got around this by using a validate block and the try method on the sum struct.

Just out of curiosity, by “we” you mean Zendesk? :slight_smile: