docs: Fix example to not produce validation errors
The previous approach generated the following error when a user has no emails ``` Processor BuiltinKindsEntityProcessor threw an error while validating the entity user:default/user; caused by TypeError: /spec/profile/email must NOT have fewer than 1 characters - limit: 1 ``` Signed-off-by: Mike Bryant <mike.bryant@mettle.co.uk>
This commit is contained in:
@@ -189,8 +189,8 @@ returned identity.
|
||||
async (user, ctx): Promise<UserEntity | undefined> => {
|
||||
const entity = await defaultUserTransformer(user, ctx);
|
||||
|
||||
if (entity && user.organizationVerifiedDomainEmails) {
|
||||
entity.spec.profile!.email = user.organizationVerifiedDomainEmails[0] || '';
|
||||
if (entity && user.organizationVerifiedDomainEmails?.length) {
|
||||
entity.spec.profile!.email = user.organizationVerifiedDomainEmails[0];
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
||||
Reference in New Issue
Block a user