2023-01-27 17:19:27 +01:00
import { FromSchema } from 'json-schema-to-ts' ;
import { parametersSchema } from './parameters-schema' ;
import { variantSchema } from './variant-schema' ;
import { overrideSchema } from './override-schema' ;
import { featureStrategySchema } from './feature-strategy-schema' ;
import { featureSchema } from './feature-schema' ;
import { constraintSchema } from './constraint-schema' ;
import { environmentSchema } from './environment-schema' ;
import { featureEnvironmentSchema } from './feature-environment-schema' ;
import { projectStatsSchema } from './project-stats-schema' ;
2023-04-28 13:59:04 +02:00
import { createFeatureStrategySchema } from './create-feature-strategy-schema' ;
import { projectEnvironmentSchema } from './project-environment-schema' ;
2023-07-13 13:50:03 +02:00
import { createStrategyVariantSchema } from './create-strategy-variant-schema' ;
import { strategyVariantSchema } from './strategy-variant-schema' ;
2023-01-27 17:19:27 +01:00
export const projectOverviewSchema = {
$id : '#/components/schemas/projectOverviewSchema' ,
type : 'object' ,
additionalProperties : false ,
required : [ 'version' , 'name' ] ,
2023-02-10 15:05:57 +01:00
description :
'A high-level overview of a project. It contains information such as project statistics, the name of the project, what members and what features it contains, etc.' ,
2023-01-27 17:19:27 +01:00
properties : {
stats : {
$ref : '#/components/schemas/projectStatsSchema' ,
2023-02-10 15:05:57 +01:00
description : 'Project statistics' ,
2023-01-27 17:19:27 +01:00
} ,
version : {
2023-07-28 08:59:05 +02:00
type : 'integer' ,
2023-02-10 15:05:57 +01:00
example : 1 ,
2023-07-28 08:59:05 +02:00
description :
'The schema version used to describe the project overview' ,
2023-01-27 17:19:27 +01:00
} ,
name : {
type : 'string' ,
2023-02-10 15:05:57 +01:00
example : 'dx-squad' ,
description : 'The name of this project' ,
2023-01-27 17:19:27 +01:00
} ,
description : {
type : 'string' ,
2023-02-10 15:05:57 +01:00
nullable : true ,
example : 'DX squad feature release' ,
description : 'Additional information about the project' ,
2023-01-27 17:19:27 +01:00
} ,
2023-03-17 13:41:59 +01:00
defaultStickiness : {
type : 'string' ,
example : 'userId' ,
description :
'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy' ,
} ,
2023-03-16 15:29:52 +01:00
mode : {
type : 'string' ,
enum : [ 'open' , 'protected' ] ,
example : 'open' ,
description :
2023-03-23 14:13:34 +01:00
"The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not." ,
2023-03-16 15:29:52 +01:00
} ,
2023-07-13 13:02:35 +02:00
featureLimit : {
type : 'number' ,
nullable : true ,
example : 100 ,
description :
'A limit on the number of features allowed in the project. Null if no limit.' ,
} ,
2023-01-27 17:19:27 +01:00
members : {
type : 'number' ,
2023-02-10 15:05:57 +01:00
example : 4 ,
description : 'The number of members this project has' ,
2023-01-27 17:19:27 +01:00
} ,
health : {
type : 'number' ,
2023-02-10 15:05:57 +01:00
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" ,
2023-01-27 17:19:27 +01:00
} ,
environments : {
type : 'array' ,
items : {
2023-04-28 13:59:04 +02:00
$ref : '#/components/schemas/projectEnvironmentSchema' ,
2023-01-27 17:19:27 +01:00
} ,
2023-04-28 13:59:04 +02:00
example : [
{ environment : 'development' } ,
{
environment : 'production' ,
defaultStrategy : {
name : 'flexibleRollout' ,
constraints : [ ] ,
parameters : {
rollout : '50' ,
stickiness : 'customAppName' ,
groupId : 'stickytoggle' ,
} ,
} ,
} ,
] ,
2023-02-10 15:05:57 +01:00
description : 'The environments that are enabled for this project' ,
2023-01-27 17:19:27 +01:00
} ,
features : {
type : 'array' ,
items : {
$ref : '#/components/schemas/featureSchema' ,
} ,
2023-02-10 15:05:57 +01:00
description :
'The full list of features in this project (excluding archived features)' ,
2023-01-27 17:19:27 +01:00
} ,
updatedAt : {
type : 'string' ,
format : 'date-time' ,
nullable : true ,
2023-02-10 15:05:57 +01:00
example : '2023-02-10T08:36:35.262Z' ,
2023-07-28 08:59:05 +02:00
description : 'When the project was last updated.' ,
2023-01-27 17:19:27 +01:00
} ,
2023-06-09 16:18:38 +02:00
createdAt : {
type : 'string' ,
format : 'date-time' ,
nullable : true ,
example : '2023-02-10T08:36:35.262Z' ,
2023-07-28 08:59:05 +02:00
description : 'When the project was created.' ,
2023-06-09 16:18:38 +02:00
} ,
2023-01-27 17:19:27 +01:00
favorite : {
type : 'boolean' ,
2023-02-10 15:05:57 +01:00
example : true ,
description :
'`true` if the project was favorited, otherwise `false`.' ,
2023-01-27 17:19:27 +01:00
} ,
} ,
components : {
schemas : {
environmentSchema ,
2023-04-28 13:59:04 +02:00
projectEnvironmentSchema ,
createFeatureStrategySchema ,
2023-07-13 13:50:03 +02:00
createStrategyVariantSchema ,
2023-04-28 13:59:04 +02:00
constraintSchema ,
2023-01-27 17:19:27 +01:00
featureSchema ,
featureEnvironmentSchema ,
overrideSchema ,
parametersSchema ,
featureStrategySchema ,
2023-07-13 13:50:03 +02:00
strategyVariantSchema ,
2023-01-27 17:19:27 +01:00
variantSchema ,
projectStatsSchema ,
} ,
} ,
} as const ;
export type ProjectOverviewSchema = FromSchema < typeof projectOverviewSchema > ;