Open tanb opened 5 years ago
If it's difference between API response and request body format,
Response Body
{ "id": 1, "username": "appleseed", "image": { "id": 42, "url": "https://example.com/image.jpg" } }
Request Body
{ "id": 1, "username": "appleseed", "image": 42 }
When decoding time, image will be Image class instance, but I don't want to encode it. I just want to send the image's id as image value in a request body.
Then EncodingKeys decorator works in just encoding time for property key mapping.
@EncodingKeys({ id: "id", username: "username", imageId: "image" }) class Profile { id: number; username: string; @CodableType(Image) image: Image; get imageId(): { return this.image.id; }; }
This will be follows after encode.
Will be implemented after #1 released.
If it's difference between API response and request body format,
Response Body
Request Body
When decoding time, image will be Image class instance, but I don't want to encode it. I just want to send the image's id as image value in a request body.
Then EncodingKeys decorator works in just encoding time for property key mapping.
This will be follows after encode.