2022-07-21 16:23:56 +02:00
|
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
import { groupUserModelSchema } from './group-user-model-schema';
|
|
|
|
import { userSchema } from './user-schema';
|
|
|
|
|
|
|
|
export const groupSchema = {
|
|
|
|
$id: '#/components/schemas/groupSchema',
|
|
|
|
type: 'object',
|
2023-07-24 11:05:55 +02:00
|
|
|
additionalProperties: false,
|
2022-07-26 13:39:55 +02:00
|
|
|
required: ['name'],
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'A detailed information about a user group',
|
2022-07-21 16:23:56 +02:00
|
|
|
properties: {
|
|
|
|
id: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'The group id',
|
|
|
|
type: 'integer',
|
|
|
|
example: 1,
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
|
|
|
name: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'The name of the group',
|
2022-07-21 16:23:56 +02:00
|
|
|
type: 'string',
|
2023-07-18 11:08:45 +02:00
|
|
|
example: 'DX team',
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
|
|
|
description: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'A custom description of the group',
|
2022-07-21 16:23:56 +02:00
|
|
|
type: 'string',
|
2023-02-09 14:21:03 +01:00
|
|
|
nullable: true,
|
2023-07-18 11:08:45 +02:00
|
|
|
example: 'Current members of the DX squad',
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
2022-10-13 12:34:47 +02:00
|
|
|
mappingsSSO: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description:
|
|
|
|
'A list of SSO groups that should map to this Unleash group',
|
2022-10-13 12:34:47 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2023-07-18 11:08:45 +02:00
|
|
|
example: ['SSOGroup1', 'SSOGroup2'],
|
2022-10-13 12:34:47 +02:00
|
|
|
},
|
2023-04-20 12:29:30 +02:00
|
|
|
rootRole: {
|
|
|
|
type: 'number',
|
|
|
|
nullable: true,
|
|
|
|
description:
|
2023-07-18 11:08:45 +02:00
|
|
|
'A role id that is used as the root role for all users in this group. This can be either the id of the Viewer, Editor or Admin role.',
|
|
|
|
example: 1,
|
2023-04-20 12:29:30 +02:00
|
|
|
},
|
2022-07-21 16:23:56 +02:00
|
|
|
createdBy: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'A user who created this group',
|
2022-07-21 16:23:56 +02:00
|
|
|
type: 'string',
|
|
|
|
nullable: true,
|
2023-07-18 11:08:45 +02:00
|
|
|
example: 'admin',
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
|
|
|
createdAt: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'When was this group created',
|
2022-07-21 16:23:56 +02:00
|
|
|
type: 'string',
|
|
|
|
format: 'date-time',
|
|
|
|
nullable: true,
|
2023-07-18 11:08:45 +02:00
|
|
|
example: '2023-06-30T11:41:00.123Z',
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
|
|
|
users: {
|
|
|
|
type: 'array',
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'A list of users belonging to this group',
|
2022-07-21 16:23:56 +02:00
|
|
|
items: {
|
|
|
|
$ref: '#/components/schemas/groupUserModelSchema',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
projects: {
|
2023-07-18 11:08:45 +02:00
|
|
|
description: 'A list of projects where this group is used',
|
2022-07-21 16:23:56 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2023-07-18 11:08:45 +02:00
|
|
|
example: ['default', 'my-project'],
|
2022-07-21 16:23:56 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
schemas: {
|
|
|
|
groupUserModelSchema,
|
|
|
|
userSchema,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type GroupSchema = FromSchema<typeof groupSchema>;
|