You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside "data" key, is the actual data that is mapped to my model objects. I know I could create each model object with the data and metadata fields and be automatically mapped. But that doesn't seem a good design to me, as "data" and "metadata" aren't part of the model object. I could also use the "map to key" function to map directly what is inside "data", but I'll be missing the metadata field in case there's a reported error from the API.
Is there any way (maybe using protocols?) to not have repeated the data and metadata keys on each of my model objects? I'm making the request with Rx like this:
Moya version:
'Moya/RxSwift', '~> 11.0'
with pod'Moya-ObjectMapper/RxSwift'
This is a design question about how to use ObjectMapper and Moya the best way. I have multiple endpoints answering with the same JSON structure:
Inside "data" key, is the actual data that is mapped to my model objects. I know I could create each model object with the data and metadata fields and be automatically mapped. But that doesn't seem a good design to me, as "data" and "metadata" aren't part of the model object. I could also use the "map to key" function to map directly what is inside "data", but I'll be missing the metadata field in case there's a reported error from the API.
Is there any way (maybe using protocols?) to not have repeated the data and metadata keys on each of my model objects? I'm making the request with Rx like this:
The text was updated successfully, but these errors were encountered: