I’ve been trying to integrate dry-validation into a legacy app to have better validation of incoming data.
Some of the data is has this JSON layout:
[
{
"affects_url": "http://localhost/" ,
"confidence": 95
},
{
"affects_url": "http://localhost/favicon.ico" ,
"confidence": 95
}
]
And my attempts of writing a contract for this so far have failed.
I thought, that this should work, but it returns an empty result:
class MyContract < Dry::Validation::Contract
json do
array do
required(:affects_url).filled(:string)
required(:confidence).filled(:integer)
end
end
end