data
data copied to clipboard
Didn't get a warning for a misspelled payload item in relationships hash
code that should have given me warning: https://github.com/emberjs/data/blob/master/addon/-private/system/store.js#L2353-L2358
my result payload:
"similiar-alerts": {
"links": {
"related": "/api/v1/alerts/8deb2777-0714-42c3-b2bd-b0925b72d2a5/similiar-alerts"
}
},
"vendor-alerts": {
"links": {
"related": "/api/v1/alerts/8deb2777-0714-42c3-b2bd-b0925b72d2a5/vendor-alerts"
}
},
my model object:
import Ember from 'ember';
import DS from 'ember-data';
const { computed } = Ember;
const { Model, attr, hasMany } = DS;
export default Model.extend({
name: attr(),
similarAlerts: hasMany('alert'),
vendorAlerts: hasMany('vendor-alert'),
});
Note that in the payload it is similiar and in the model object similar.
Thanks!
The reason we don’t hit them (I suspect) is that we copy over only known attributes and relationships in the serializer to the final payload, would need to dig in to confirm that.
so TL;DR we should have this validation layer in both places, or make sure the defaults don't remove things they don't understand so that these warnings will be encountered.