1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00
unleash.unleash/src/lib/openapi/spec/personal-dashboard-schema.ts
2024-09-26 15:51:51 +02:00

89 lines
3.1 KiB
TypeScript

import type { FromSchema } from 'json-schema-to-ts';
export const personalDashboardSchema = {
$id: '#/components/schemas/personalDashboardSchema',
type: 'object',
description: 'Project and flags relevant to the user',
additionalProperties: false,
required: ['projects', 'flags'],
properties: {
projects: {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
required: [
'id',
'name',
'health',
'memberCount',
'featureCount',
],
properties: {
id: {
type: 'string',
example: 'my-project-id',
description: 'The id of the project',
},
name: {
type: 'string',
example: 'My Project',
description: 'The name of the project',
},
health: {
type: 'number',
example: 50,
description:
"An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#health-rating) on a scale from 0 to 100",
},
memberCount: {
type: 'number',
example: 4,
description: 'The number of members this project has',
},
featureCount: {
type: 'number',
example: 10,
description: 'The number of features this project has',
},
},
},
description:
'A list of projects that a user participates in with any role e.g. member or owner or any custom role',
},
flags: {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
required: ['name', 'project', 'type'],
properties: {
name: {
type: 'string',
example: 'my-flag',
description: 'The name of the flag',
},
project: {
type: 'string',
example: 'my-project-id',
description: 'The id of the feature project',
},
type: {
type: 'string',
example: 'release',
description: 'The type of the feature flag',
},
},
},
description: 'A list of flags a user created or favorited',
},
},
components: {
schemas: {},
},
} as const;
export type PersonalDashboardSchema = FromSchema<
typeof personalDashboardSchema
>;