1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/openapi/spec/project-overview-schema.ts
andreas-unleash 1ccbbfeb57
Feat: project default strategy (#3644)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

Adds default strategy to project environment link table

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-876](https://linear.app/unleash/issue/1-876/default-strategy-backend)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-28 14:59:04 +03:00

126 lines
4.5 KiB
TypeScript

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';
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
import { projectEnvironmentSchema } from './project-environment-schema';
export const projectOverviewSchema = {
$id: '#/components/schemas/projectOverviewSchema',
type: 'object',
additionalProperties: false,
required: ['version', 'name'],
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.',
properties: {
stats: {
$ref: '#/components/schemas/projectStatsSchema',
description: 'Project statistics',
},
version: {
type: 'number',
example: 1,
},
name: {
type: 'string',
example: 'dx-squad',
description: 'The name of this project',
},
description: {
type: 'string',
nullable: true,
example: 'DX squad feature release',
description: 'Additional information about the project',
},
defaultStickiness: {
type: 'string',
example: 'userId',
description:
'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy',
},
mode: {
type: 'string',
enum: ['open', 'protected'],
example: 'open',
description:
"The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not.",
},
members: {
type: 'number',
example: 4,
description: 'The number of members this project has',
},
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",
},
environments: {
type: 'array',
items: {
$ref: '#/components/schemas/projectEnvironmentSchema',
},
example: [
{ environment: 'development' },
{
environment: 'production',
defaultStrategy: {
name: 'flexibleRollout',
constraints: [],
parameters: {
rollout: '50',
stickiness: 'customAppName',
groupId: 'stickytoggle',
},
},
},
],
description: 'The environments that are enabled for this project',
},
features: {
type: 'array',
items: {
$ref: '#/components/schemas/featureSchema',
},
description:
'The full list of features in this project (excluding archived features)',
},
updatedAt: {
type: 'string',
format: 'date-time',
nullable: true,
example: '2023-02-10T08:36:35.262Z',
},
favorite: {
type: 'boolean',
example: true,
description:
'`true` if the project was favorited, otherwise `false`.',
},
},
components: {
schemas: {
environmentSchema,
projectEnvironmentSchema,
createFeatureStrategySchema,
constraintSchema,
featureSchema,
featureEnvironmentSchema,
overrideSchema,
parametersSchema,
featureStrategySchema,
variantSchema,
projectStatsSchema,
},
},
} as const;
export type ProjectOverviewSchema = FromSchema<typeof projectOverviewSchema>;