You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been discussing potentially having push normalize the type to ensure it is singular. Roughly the current thinking is that by the time payloads enter the store (via store.push) they are supposed to have already been normalized. This includes making type singular and dasherized.
Why singular and dasherized?
A few reasons:
They are dasherized because the type should match the file-name the Model is defined in, and file-names are typically dasherized.
They are singular by convention partly since records tend to be worked with one at a time in the singular (think of the dissonance of store.createRecord('users', {}), and partly because file names are also typically singular for a file/module representing one thing (a User class for instance) and plural for a file/module representing a collection of things.
This constraint is one we tend to lift. Most places in the internals we no longer normalize type, we accept whatever you gave us. While this can lead to mistakes (e.g. in one place you normalize to users and in another user), we are working towards a world in which the convention on type is entirely left to the consuming application.
Closing because we don't want to add more normalization and we are currently working to deprecate what normalization we already do via RFCs emberjs/rfcs#739 and emberjs/rfcs#740
Is there a reason behind
store.push
only supporting singular types?The text was updated successfully, but these errors were encountered: