1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-21 13:47:39 +02:00
unleash.unleash/src/lib/openapi/spec/addon-schema.ts
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

79 lines
2.7 KiB
TypeScript

import type { FromSchema } from 'json-schema-to-ts';
export const addonSchema = {
$id: '#/components/schemas/addonSchema',
type: 'object',
description: `An [addon](https://docs.getunleash.io/reference/addons) instance description. Contains data about what kind of provider it uses, whether it's enabled or not, what events it listens for, and more.`,
required: [
'id',
'description',
'provider',
'enabled',
'parameters',
'events',
],
properties: {
id: {
type: 'integer',
minimum: 1,
example: 27,
description: "The addon's unique identifier.",
},
provider: {
type: 'string',
description: `The addon provider, such as "webhook" or "slack".`,
example: 'webhook',
},
description: {
type: 'string',
description:
'A description of the addon. `null` if no description exists.',
example:
'This addon posts updates to our internal feature tracking system whenever a feature is created or updated.',
nullable: true,
},
enabled: {
type: 'boolean',
description: 'Whether the addon is enabled or not.',
},
parameters: {
type: 'object',
additionalProperties: {},
example: {
url: 'http://localhost:4242/webhook',
},
description:
'Parameters for the addon provider. This object has different required and optional properties depending on the provider you choose.',
},
events: {
type: 'array',
description: 'The event types that trigger this specific addon.',
items: {
type: 'string',
},
example: ['feature-created', 'feature-updated'],
},
projects: {
type: 'array',
description:
'The projects that this addon listens to events from. An empty list means it listens to events from **all** projects.',
example: ['new-landing-project', 'signups-v2'],
items: {
type: 'string',
},
},
environments: {
type: 'array',
description:
'The list of environments that this addon listens to events from. An empty list means it listens to events from **all** environments.',
example: ['development', 'production'],
items: {
type: 'string',
},
},
},
components: {},
} as const;
export type AddonSchema = FromSchema<typeof addonSchema>;