Hello!
I’m writing a custom HTTP adapter for one of the APIs i have to consume and all the list resources are returning their data under the parent node. So, for a list of products, the response would be:
{
"products": [
{ "id": 1 },
{ "id": 2 },
]
}
While, from what i understand, a following resource definition expects the results to not be nested:
module Presta
module Resources
class Products < ROM::Relation[:http]
schema(:products) do
attribute :id, Types::Integer
end
end
end
end
# => :id is missing in Hash input (Dry::Types::MissingKeyError)
What would be the easiest way of telling rom-http to use the nested dataset instead of operating on the parent node? Thanks in advance for any clues, i tried googling for that but was not able to find anything helpful.