From 6c3575a1575769375b2c5b884fe70466a6c1c2b2 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:09:29 +0200 Subject: [PATCH 1/8] chore: update types, descriptions, and minimum numbers for insights --- ...rsonal-dashboard-project-details-schema.ts | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts index 74703fbc1c12..98be309f6356 100644 --- a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts @@ -17,7 +17,8 @@ export const personalDashboardProjectDetailsSchema = { properties: { insights: { type: 'object', - description: 'Insights for the project', + description: + 'Insights for the project, including flag data and project health information.', additionalProperties: false, required: [ 'avgHealthCurrentWindow', @@ -30,44 +31,52 @@ export const personalDashboardProjectDetailsSchema = { ], properties: { avgHealthCurrentWindow: { - type: 'number', + type: 'integer', + min: 0, description: - 'The average health score in the current window of the last 4 weeks', + "The project's average health score over the last 4 weeks", example: 80, nullable: true, }, avgHealthPastWindow: { - type: 'number', + type: 'integer', + min: 0, description: - 'The average health score in the previous 4 weeks before the current window', + "The project's average health score over the previous 4-week window", example: 70, nullable: true, }, totalFlags: { - type: 'number', + type: 'integer', + min: 0, example: 100, - description: 'The current number of all flags', + description: 'The current number of non-archived flags', }, activeFlags: { - type: 'number', + type: 'integer', + min: 0, example: 98, - description: 'The current number of active flags', + description: + 'The number of active flags that are not stale or potentially stale', }, staleFlags: { - type: 'number', + type: 'integer', + min: 0, example: 0, description: - 'The current number of user marked stale flags', + 'The current number of flags that have been manually marked as stale', }, potentiallyStaleFlags: { - type: 'number', + type: 'integer', + min: 0, example: 2, description: - 'The current number of time calculated potentially stale flags', + 'The number of potentially stale flags as calculated by Unleash', }, health: { - type: 'number', - description: 'The current health score of the project', + type: 'integer', + min: 0, + description: "The project's current health score", example: 80, }, }, From 0323995976b105738a47c39c1ea3c14b1f30e11f Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:09:49 +0200 Subject: [PATCH 2/8] chore: remove root roles from the role enum. We've decided that we'll only return project roles for now. --- .../openapi/spec/personal-dashboard-project-details-schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts index 98be309f6356..2b720c3311c9 100644 --- a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts @@ -138,7 +138,7 @@ export const personalDashboardProjectDetailsSchema = { }, type: { type: 'string', - enum: ['custom', 'project', 'root', 'custom-root'], + enum: ['custom', 'project'], example: 'project', description: 'The type of the role', }, From 6169645756ac435459e1b88035cd1e35f7d6bf8b Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:11:43 +0200 Subject: [PATCH 3/8] chore: make img url mandatory --- .../src/openapi/models/personalDashboardSchemaAdminsItem.ts | 2 +- src/lib/openapi/spec/personal-dashboard-schema.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts b/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts index 51abb597209b..340cb53a9b1e 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts @@ -8,7 +8,7 @@ export type PersonalDashboardSchemaAdminsItem = { email?: string; /** The user ID. */ id: number; - imageUrl?: string; + imageUrl: string; /** The user's name. */ name?: string; /** The user's username. */ diff --git a/src/lib/openapi/spec/personal-dashboard-schema.ts b/src/lib/openapi/spec/personal-dashboard-schema.ts index 765750bc0026..43a872a7b6cb 100644 --- a/src/lib/openapi/spec/personal-dashboard-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-schema.ts @@ -12,7 +12,7 @@ export const personalDashboardSchema = { description: 'Users with the admin role in Unleash.', items: { type: 'object', - required: ['id'], + required: ['id', 'imageUrl'], properties: { id: { type: 'integer', From c551916015e7887e4a19cbe3a2e7ef56d7339cf1 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:13:51 +0200 Subject: [PATCH 4/8] chore: make img url mandatory for project owners --- .../openapi/models/personalDashboardSchemaProjectOwnersItem.ts | 3 +-- src/lib/openapi/spec/personal-dashboard-schema.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts index 0bdadec92b0a..c5e68ab5896d 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts @@ -13,9 +13,8 @@ export type PersonalDashboardSchemaProjectOwnersItem = { email?: string | null; /** * The URL of the user's profile image. - * @nullable */ - imageUrl?: string | null; + imageUrl: string; /** The name displayed for the user. Can be the user's name, username, or email, depending on what they have provided. */ name: string; /** The type of the owner; will always be `user`. */ diff --git a/src/lib/openapi/spec/personal-dashboard-schema.ts b/src/lib/openapi/spec/personal-dashboard-schema.ts index 43a872a7b6cb..ae6c8e25317a 100644 --- a/src/lib/openapi/spec/personal-dashboard-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-schema.ts @@ -46,7 +46,7 @@ export const personalDashboardSchema = { 'Users with the project owner role in Unleash. Only contains owners of projects that are visible to the user.', items: { type: 'object', - required: ['ownerType', 'name'], + required: ['ownerType', 'name', 'imageUrl'], properties: { ownerType: { type: 'string', From 4bdfc7e5fe4b3e7f30b7fb4a01b4f997462f237b Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:15:57 +0200 Subject: [PATCH 5/8] chore: use the right property --- .../personal-dashboard-project-details-schema.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts index 2b720c3311c9..35114079e17b 100644 --- a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts @@ -32,7 +32,7 @@ export const personalDashboardProjectDetailsSchema = { properties: { avgHealthCurrentWindow: { type: 'integer', - min: 0, + minimum: 0, description: "The project's average health score over the last 4 weeks", example: 80, @@ -40,7 +40,7 @@ export const personalDashboardProjectDetailsSchema = { }, avgHealthPastWindow: { type: 'integer', - min: 0, + minimum: 0, description: "The project's average health score over the previous 4-week window", example: 70, @@ -48,34 +48,34 @@ export const personalDashboardProjectDetailsSchema = { }, totalFlags: { type: 'integer', - min: 0, + minimum: 0, example: 100, description: 'The current number of non-archived flags', }, activeFlags: { type: 'integer', - min: 0, + minimum: 0, example: 98, description: 'The number of active flags that are not stale or potentially stale', }, staleFlags: { type: 'integer', - min: 0, + minimum: 0, example: 0, description: 'The current number of flags that have been manually marked as stale', }, potentiallyStaleFlags: { type: 'integer', - min: 0, + minimum: 0, example: 2, description: 'The number of potentially stale flags as calculated by Unleash', }, health: { type: 'integer', - min: 0, + minimum: 0, description: "The project's current health score", example: 80, }, From 3a263de31669423d78945b18bac960b9c836d5cd Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 09:16:40 +0200 Subject: [PATCH 6/8] chore: number -> integer in dashboard schema --- src/lib/openapi/spec/personal-dashboard-schema.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/openapi/spec/personal-dashboard-schema.ts b/src/lib/openapi/spec/personal-dashboard-schema.ts index ae6c8e25317a..cc0bc05d8d2c 100644 --- a/src/lib/openapi/spec/personal-dashboard-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-schema.ts @@ -99,19 +99,22 @@ export const personalDashboardSchema = { description: 'The name of the project', }, health: { - type: 'number', + type: 'integer', example: 50, + minimum: 0, 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', + type: 'integer', example: 4, + minimum: 0, description: 'The number of members this project has', }, featureCount: { - type: 'number', + type: 'integer', example: 10, + minimum: 0, description: 'The number of features this project has', }, }, From 42ea145bb4716bcfab9bdaebe867baa5a6e28db7 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 11:40:45 +0200 Subject: [PATCH 7/8] Revert "chore: make img url mandatory" This reverts commit 6169645756ac435459e1b88035cd1e35f7d6bf8b. --- .../src/openapi/models/personalDashboardSchemaAdminsItem.ts | 2 +- src/lib/openapi/spec/personal-dashboard-schema.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts b/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts index 340cb53a9b1e..51abb597209b 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts @@ -8,7 +8,7 @@ export type PersonalDashboardSchemaAdminsItem = { email?: string; /** The user ID. */ id: number; - imageUrl: string; + imageUrl?: string; /** The user's name. */ name?: string; /** The user's username. */ diff --git a/src/lib/openapi/spec/personal-dashboard-schema.ts b/src/lib/openapi/spec/personal-dashboard-schema.ts index cc0bc05d8d2c..a20f0520ab50 100644 --- a/src/lib/openapi/spec/personal-dashboard-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-schema.ts @@ -12,7 +12,7 @@ export const personalDashboardSchema = { description: 'Users with the admin role in Unleash.', items: { type: 'object', - required: ['id', 'imageUrl'], + required: ['id'], properties: { id: { type: 'integer', From f831a332b4651216be4ef6ee92bd004ac9d11acd Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Oct 2024 11:41:05 +0200 Subject: [PATCH 8/8] Revert "chore: make img url mandatory for project owners" This reverts commit c551916015e7887e4a19cbe3a2e7ef56d7339cf1. --- .../openapi/models/personalDashboardSchemaProjectOwnersItem.ts | 3 ++- src/lib/openapi/spec/personal-dashboard-schema.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts index c5e68ab5896d..0bdadec92b0a 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaProjectOwnersItem.ts @@ -13,8 +13,9 @@ export type PersonalDashboardSchemaProjectOwnersItem = { email?: string | null; /** * The URL of the user's profile image. + * @nullable */ - imageUrl: string; + imageUrl?: string | null; /** The name displayed for the user. Can be the user's name, username, or email, depending on what they have provided. */ name: string; /** The type of the owner; will always be `user`. */ diff --git a/src/lib/openapi/spec/personal-dashboard-schema.ts b/src/lib/openapi/spec/personal-dashboard-schema.ts index a20f0520ab50..fe3717676ff6 100644 --- a/src/lib/openapi/spec/personal-dashboard-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-schema.ts @@ -46,7 +46,7 @@ export const personalDashboardSchema = { 'Users with the project owner role in Unleash. Only contains owners of projects that are visible to the user.', items: { type: 'object', - required: ['ownerType', 'name', 'imageUrl'], + required: ['ownerType', 'name'], properties: { ownerType: { type: 'string',