open-vault/ui/app/serializers/pki/role.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

22 lines
635 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import ApplicationSerializer from '../application';
export default class PkiRoleSerializer extends ApplicationSerializer {
attrs = {
name: { serialize: false },
};
serialize() {
const json = super.serialize(...arguments);
// attributes with empty arrays are stripped from serialized json
// but an empty list is acceptable for key_usage to specify no default constraints
// intercepting here to ensure an empty array persists (the backend assumes default values)
json.key_usage = json.key_usage || [];
return json;
}
}