Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] - add a public Typescript interface for the minimal required serializer interface #6113

Closed

Conversation

pete-the-pete
Copy link
Contributor

@runspired is this even close? Looking at some other TS interface definitions, is seems like there are a few layers of definitions, in this case DS.Store, DS.Model. Should those be defined as well?

How should this be tested?

export default interface Serializer {
store: any;
normalize(typeClass: any, hash: any): any;
normalizeResponse(store: any, primaryModelClass: any, payload: JsonApiResource, id: string | number, requestType: string): any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the minimal serializer need to have both normalize and normalizeResponse?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runspired @igorT seems like a good opportunity to nix normalize?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store.normalize is our only non-serializer code that calls Serializer.normalize, agreed that we should nix it, would involve deprecating Store.normalize.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean I should remove it from this? or add the deprecation to Store.normalize?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My view is that we should nix this; the serializer interface should have only normalizeResponse and serialize

@runspired is quite right that we should separately deprecate the other hooks.

We should add tests to verify that you can write a userland serializer that implements only those two hooks.

@pete-the-pete
Copy link
Contributor Author

pete-the-pete commented May 15, 2019 via email

@runspired
Copy link
Contributor

We may also have to include serializeIntoHash due to their usage in in JSONAPIAdapter and RESTAdapter for updateRecord and createRecord. However given these are user configurable hooks it may be viable to simply make a note that using these adapters out-of-the-box with a custom serializer will require a tiny amount of customization as well.

@runspired
Copy link
Contributor

Closing in favor of #6451

@runspired runspired closed this Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌲 Project Trim 🌲 PRs related to https://github.com/emberjs/data/issues/6166
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants