kamikat / moshi-jsonapi

JSON API v1.0 Specification in Moshi.
MIT License
156 stars 34 forks source link

Is there any annotation for id like type? #38

Closed deshmukhrohit11 closed 7 years ago

deshmukhrohit11 commented 7 years ago

I need to map Contacts id to one of the attribute. Do we have any annotation for it?

I need to map id to another attribute in Contacts class. Like contactId map to id("id": "5210") { "data": [ { "type": "contacts", "id": "5210", "attributes": {} } ] }

Class: @JsonApi(type = "contacts") public class Contact extends Resource {

private int contactId; // I want to map it to  "id": "5210"

}

deshmukhrohit11 commented 7 years ago

Any one how to do this? I am blocked because of this issue.

kamikat commented 7 years ago

I'm afraid it's impossible to do this mapping. And the id of a resource can only be accessed using Contact.getId().