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:
Mike Bryant
2023-05-23 11:10:16 +01:00
committed by Mike Bryant
parent 1c907ad726
commit 96d9aee0a9
+2 -2
View File
@@ -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;