Guard against a null Meta property in the scale event API
This commit is contained in:
parent
d0495e1b56
commit
58ecacc710
|
@ -20,6 +20,17 @@ export default class Application extends JSONSerializer {
|
|||
*/
|
||||
arrayNullOverrides = null;
|
||||
|
||||
/**
|
||||
A list of keys that are converted to empty objects if their value is null.
|
||||
|
||||
objectNullOverrides = ['Object'];
|
||||
{ Object: null } => { Object: {} }
|
||||
|
||||
@property objectNullOverrides
|
||||
@type String[]
|
||||
*/
|
||||
objectNullOverrides = null;
|
||||
|
||||
/**
|
||||
A list of keys or objects to convert a map into an array of maps with the original map keys as Name properties.
|
||||
|
||||
|
@ -90,6 +101,13 @@ export default class Application extends JSONSerializer {
|
|||
}
|
||||
});
|
||||
}
|
||||
if (this.objectNullOverrides) {
|
||||
this.objectNullOverrides.forEach(key => {
|
||||
if (!hash[key]) {
|
||||
hash[key] = {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.mapToArray) {
|
||||
this.mapToArray.forEach(conversion => {
|
||||
|
|
|
@ -2,4 +2,5 @@ import ApplicationSerializer from './application';
|
|||
|
||||
export default class ScaleEventSerializer extends ApplicationSerializer {
|
||||
separateNanos = ['Time'];
|
||||
objectNullOverrides = ['Meta'];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue