From 83a7b65263dad491643a4b4bea14bf9f1dae75ab Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:30:58 +0000 Subject: [PATCH 1/2] fix(config): add descriptions to JSON schema properties --- src/types/plugin-input.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/types/plugin-input.ts b/src/types/plugin-input.ts index 97509b7..504da8d 100644 --- a/src/types/plugin-input.ts +++ b/src/types/plugin-input.ts @@ -48,42 +48,41 @@ function mapWebhookToEvent(webhook: WhitelistEvent) { return roleMap.get(webhook); } -const EventWhitelistType = T.Union(eventWhitelist.map((event) => T.Literal(event))); - export const pluginSettingsSchema = T.Object( { /** * Delay to send reminders. 0 means disabled. Any other value is counted in days, e.g. 1,5 days */ - warning: thresholdType({ default: "3.5 days" }), + warning: thresholdType({ default: "3.5 days", description: "Delay to send reminders. 0 means disabled and any other value is counted in days, e.g. 1,5 days" }), /** * By default, all repositories are watched. Use this option to opt-out from watching specific repositories * within your organization. The value is an array of repository names. */ watch: T.Object( { - optOut: T.Array(T.String(), { default: [] }), + optOut: T.Array(T.String(), { default: [], description: "List of repositories to opt-out from watching user activity within the organization" }), }, { default: {} } ), /* * Whether to rush the follow ups by the priority level */ - prioritySpeed: T.Boolean({ default: true }), + prioritySpeed: T.Boolean({ default: true, description: "Whether to rush the follow ups by the priority level" }), /** * Delay to unassign users. 0 means disabled. Any other value is counted in days, e.g. 7 days */ disqualification: thresholdType({ default: "7 days", + description: "Delay to unassign users. 0 means disabled and any other value is counted in days, e.g. 7 days", }), /** * Whether a pull request is required for the given issue on disqualify. */ - pullRequestRequired: T.Boolean({ default: true }), + pullRequestRequired: T.Boolean({ default: true, description: "Whether a pull request is required for the given issue on disqualify" }), /** * List of events to consider as valid activity on a task */ - eventWhitelist: T.Transform(T.Array(T.String(), { default: eventWhitelist })) + eventWhitelist: T.Transform(T.Array(T.String(), { default: eventWhitelist, description: "List of webhook event names to consider as valid activity on a task" })) .Decode((value) => { const validEvents = Object.values(eventWhitelist); let eventsStripped: TimelineEvent[] = []; From b2fae71d30cf9825bfd39505d8619dfe96f4152b Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:48:02 +0000 Subject: [PATCH 2/2] chore: config examples --- src/types/plugin-input.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/types/plugin-input.ts b/src/types/plugin-input.ts index 504da8d..5a0e9a1 100644 --- a/src/types/plugin-input.ts +++ b/src/types/plugin-input.ts @@ -53,14 +53,22 @@ export const pluginSettingsSchema = T.Object( /** * Delay to send reminders. 0 means disabled. Any other value is counted in days, e.g. 1,5 days */ - warning: thresholdType({ default: "3.5 days", description: "Delay to send reminders. 0 means disabled and any other value is counted in days, e.g. 1,5 days" }), + warning: thresholdType({ + default: "3.5 days", + description: "Delay to send reminders. 0 means disabled and any other value is counted in days, e.g. 1,5 days", + examples: ["3.5 days", "1 day"] + }), /** * By default, all repositories are watched. Use this option to opt-out from watching specific repositories * within your organization. The value is an array of repository names. */ watch: T.Object( { - optOut: T.Array(T.String(), { default: [], description: "List of repositories to opt-out from watching user activity within the organization" }), + optOut: T.Array(T.String(), { + default: [], + description: "List of repositories to opt-out from watching user activity within the organization", + examples: ["repoName", "no-owner-required"] + }), }, { default: {} } ), @@ -74,6 +82,7 @@ export const pluginSettingsSchema = T.Object( disqualification: thresholdType({ default: "7 days", description: "Delay to unassign users. 0 means disabled and any other value is counted in days, e.g. 7 days", + examples: ["7 days", "1 day"] }), /** * Whether a pull request is required for the given issue on disqualify. @@ -82,7 +91,11 @@ export const pluginSettingsSchema = T.Object( /** * List of events to consider as valid activity on a task */ - eventWhitelist: T.Transform(T.Array(T.String(), { default: eventWhitelist, description: "List of webhook event names to consider as valid activity on a task" })) + eventWhitelist: T.Transform(T.Array(T.String(), { + default: eventWhitelist, + description: "List of webhook event names to consider as valid activity on a task", + examples: ["pull_request.review_requested", "issue_comment.created", "push"] + })) .Decode((value) => { const validEvents = Object.values(eventWhitelist); let eventsStripped: TimelineEvent[] = [];