Open lukemelia opened 5 years ago
Resource
object is designed immutable. And it can't parse a JSON to update itself I think.
@kamikat Thanks for the response. I appreciate it.
I think that I don't have a clear idea of what update patterns should look like with moshi/moshi-jsonapi.
If I have a simple form to update the name and email address of a person. And I have Person resource object, I imagined that I would call person.setName(...)
and person.setEmail(...)` and then generate json from the person's document to make a PUT request to the JSON-API endpoint. I would then take the response and use it to update the person resource.
It sounds like you're saying that is not possible or recommended. How would you suggest handling this?
If I get an updated JSON-API string back from the server is there a way to use it to update an existing Resource instance rather than creating a new one? I didn't see anything in the docs or code about this, so I thought I would ask how others have approached this.