Merge branch 'main' into chore-add-pref-endpoints

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-02-16 14:04:07 -08:00
commit 13c349b996
1 file changed
+16
+16
View File
@@ -1,4 +1,5 @@
import ApplicationSerializer from './application';
import { copy } from 'ember-copy';
const fieldByType = {
aws: ['preferred_endpoints', 'filters'],
@@ -69,4 +70,19 @@ export default class HostSetSerializer extends ApplicationSerializer {
}
return value;
}
/**
* Temporarily converts `filters` to an array if it is a string. This is a
* quirk of the API.
*
* TODO: remove once API consistently returns arrays.
*/
normalize(typeClass, hash, ...rest) {
const normalizedHash = copy(hash, true);
if (typeof normalizedHash?.filters === 'string') {
normalizedHash.filters = [normalizedHash.filters];
}
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
return normalized;
}
}