added support for the 'members' field of the Group entity, allowing specification of direct members from the Group side of the relationship. added support to the BuiltinKindsEntityProcessor to generate the appropriate relationships. updated documentation.
Signed-off-by: Jonah Grimes <jonah.grimes@gmail.com>
This commit is contained in:
@@ -172,4 +172,26 @@ describe('GroupV1alpha1Validator', () => {
|
||||
(entity as any).spec.children = [];
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
// members
|
||||
|
||||
it('accepts missing members', async () => {
|
||||
delete (entity as any).spec.members;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('rejects empty members', async () => {
|
||||
(entity as any).spec.members = [''];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/members/);
|
||||
});
|
||||
|
||||
it('rejects undefined members', async () => {
|
||||
(entity as any).spec.members = [undefined];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/members/);
|
||||
});
|
||||
|
||||
it('accepts no members', async () => {
|
||||
(entity as any).spec.members = [];
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface GroupEntityV1alpha1 extends Entity {
|
||||
};
|
||||
parent?: string;
|
||||
children: string[];
|
||||
members?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,15 @@
|
||||
"examples": ["backstage", "other"],
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"members": {
|
||||
"type": "array",
|
||||
"description": "The users that are members of this group. The entries of this array are entity references.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"examples": ["jdoe"],
|
||||
"minLength": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user