diff --git a/addons/api/addon/generated/models/host-catalog.js b/addons/api/addon/generated/models/host-catalog.js index 6c5770790..8ef67e385 100644 --- a/addons/api/addon/generated/models/host-catalog.js +++ b/addons/api/addon/generated/models/host-catalog.js @@ -73,14 +73,14 @@ export default class GeneratedHostCatalogModel extends BaseModel { @attr('string', { isNestedAttribute: true, - writeOnce: true, + writeOnly: true, description: '', }) access_key_id; @attr('string', { isNestedAttribute: true, - writeOnce: true, + writeOnly: true, description: '', }) secret_access_key; @@ -107,14 +107,14 @@ export default class GeneratedHostCatalogModel extends BaseModel { @attr('string', { isNestedAttribute: true, - writeOnce: true, + writeOnly: true, description: '', }) secret_id; @attr('string', { isNestedAttribute: true, - writeOnce: true, + writeOnly: true, description: '', }) secret_value; diff --git a/addons/api/addon/serializers/application.js b/addons/api/addon/serializers/application.js index 26d215219..570e76ceb 100644 --- a/addons/api/addon/serializers/application.js +++ b/addons/api/addon/serializers/application.js @@ -43,8 +43,6 @@ export default class ApplicationSerializer extends RESTSerializer { if (type === 'string' && json[key] === '') json[key] = null; // Do not serialize read-only attributes. if (options.readOnly) delete json[key]; - // Only serialize write-once fields on create. - if (options.writeOnce && !snapshot.record.isNew) delete json[key]; // Version is sent only if it has a non-nullish value if (key === 'version') { if (json[key] === null || json[key] === undefined) delete json[key]; @@ -207,6 +205,10 @@ export default class ApplicationSerializer extends RESTSerializer { const scopeID = get(normalizedHash, 'scope.id'); if (scopeID) normalizedHash.scope.scope_id = scopeID; normalizedHash = this.normalizeNestedAttributes(typeClass, normalizedHash); + // Delete any lingering values on write-only fields + typeClass.attributes.forEach((attribute) => { + if (attribute.options.writeOnly) hash[attribute.name] = null; + }); return super.normalize(typeClass, normalizedHash); }