Serializer Option

Created on 26 July 2023, over 1 year ago
Updated 4 October 2023, about 1 year ago

Problem/Motivation

It should be possible to work with both the raw JSON:API response, along with a version that has been deserialized into a simpler JS object.

Proposed resolution

I still have a lot of questions about what we need to support for 1.0 (will dump some raw thoughts in a follow up issue), but after researching this a bit I actually think what is appropriate to support for the vertical slice POC is actually pretty clear.

The options argument of the ApiClient class will support an additional optional 'serializer' property which is an instance of a custom serializer that has a deserialize method. If this option is provided, the response will be deserialized.

Remaining tasks

** Add serializer option to base ApiClient class.
** Deserialize result if this option is provided.
** Test in instance of JsonApiClient and compatible serializer libraries - https://github.com/olosegres/jsona? https://github.com/SeyZ/jsonapi-serializer?
* Define necessary types
* Update inline documentation.
* Add test coverage.

API changes

* The options object will now include a serializer property.

Data model changes

* Data will be deserialized if a compatible serializer is provided.

Feature request
Status

Fixed

Component

Code

Created by

🇺🇸United States brianperry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024