2024-03-18 13:58:05 +01:00
|
|
|
import type { FromSchema } from 'json-schema-to-ts';
|
2022-09-29 15:27:54 +02:00
|
|
|
import { featureSchema } from './feature-schema';
|
2022-09-30 13:36:45 +02:00
|
|
|
import { roleSchema } from './role-schema';
|
2022-09-29 15:27:54 +02:00
|
|
|
|
|
|
|
export const profileSchema = {
|
|
|
|
$id: '#/components/schemas/profileSchema',
|
|
|
|
type: 'object',
|
|
|
|
additionalProperties: false,
|
2023-07-06 15:27:43 +02:00
|
|
|
description: 'User profile overview',
|
2022-09-29 15:27:54 +02:00
|
|
|
required: ['rootRole', 'projects', 'features'],
|
|
|
|
properties: {
|
|
|
|
rootRole: {
|
2022-09-30 13:36:45 +02:00
|
|
|
$ref: '#/components/schemas/roleSchema',
|
2022-09-29 15:27:54 +02:00
|
|
|
},
|
|
|
|
projects: {
|
2023-07-06 15:27:43 +02:00
|
|
|
description: 'Which projects this user is a member of',
|
2022-09-29 15:27:54 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2023-07-06 15:27:43 +02:00
|
|
|
example: ['my-projectA', 'my-projectB'],
|
2022-09-29 15:27:54 +02:00
|
|
|
},
|
|
|
|
features: {
|
2023-07-06 15:27:43 +02:00
|
|
|
description: 'Deprecated, always returns empty array',
|
2022-09-29 15:27:54 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
$ref: '#/components/schemas/featureSchema',
|
|
|
|
},
|
2023-07-06 15:27:43 +02:00
|
|
|
example: [],
|
2022-09-29 15:27:54 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
schemas: {
|
|
|
|
featureSchema,
|
2022-09-30 13:36:45 +02:00
|
|
|
roleSchema,
|
2022-09-29 15:27:54 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type ProfileSchema = FromSchema<typeof profileSchema>;
|