1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

OpenAPI: clean up remaining schemas, part 1 (#4351)

Part of linear task 1-1167. Fixes the first slew of schemas missing
descriptions/examples, etc.
This commit is contained in:
Thomas Heartman 2023-07-28 08:45:56 +02:00 committed by GitHub
parent fc54877473
commit 12209ae21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 9 deletions

View File

@ -90,7 +90,6 @@ const metaRules: Rule[] = [
},
},
knownExceptions: [
'createInvitedUserSchema',
'featureStrategySegmentSchema',
'maintenanceSchema',
'toggleMaintenanceSchema',
@ -118,12 +117,6 @@ const metaRules: Rule[] = [
required: ['description'],
},
knownExceptions: [
'adminFeaturesQuerySchema',
'applicationSchema',
'applicationsSchema',
'createFeatureSchema',
'createInvitedUserSchema',
'dateSchema',
'featureStrategySegmentSchema',
'maintenanceSchema',
'toggleMaintenanceSchema',

View File

@ -4,6 +4,8 @@ export const adminFeaturesQuerySchema = {
$id: '#/components/schemas/adminFeaturesQuerySchema',
type: 'object',
additionalProperties: false,
description:
'Query parameters used to modify the list of features returned.',
properties: {
tag: {
type: 'array',

View File

@ -3,6 +3,8 @@ import { FromSchema } from 'json-schema-to-ts';
export const applicationSchema = {
$id: '#/components/schemas/applicationSchema',
type: 'object',
description:
"Data about an application that's connected to Unleash via an SDK.",
additionalProperties: false,
required: ['appName'],
properties: {

View File

@ -4,11 +4,13 @@ import { FromSchema } from 'json-schema-to-ts';
export const applicationsSchema = {
$id: '#/components/schemas/applicationsSchema',
additionalProperties: false,
description:
'An object containing a list of applications that have connected to Unleash via an SDK.',
type: 'object',
properties: {
applications: {
description:
'Contains a list of applications that have connected via an SDK',
'The list of applications that have connected to this Unleash instance.',
type: 'array',
items: {
$ref: '#/components/schemas/applicationSchema',

View File

@ -3,6 +3,7 @@ import { FromSchema } from 'json-schema-to-ts';
export const createFeatureSchema = {
$id: '#/components/schemas/createFeatureSchema',
type: 'object',
description: 'Data used to create a new feature toggle.',
required: ['name'],
properties: {
name: {

View File

@ -5,18 +5,27 @@ export const createInvitedUserSchema = {
type: 'object',
additionalProperties: false,
required: ['email', 'name', 'password'],
description: 'Data used to create a user that has been invited to Unleash.',
properties: {
username: {
type: 'string',
description: "The user's username. Must be unique if provided.",
example: 'Hunter',
},
email: {
type: 'string',
description: "The invited user's email address",
example: 'hunter@example.com',
},
name: {
type: 'string',
description: "The user's name",
example: 'Hunter Burgan',
},
password: {
type: 'string',
description: "The user's password",
example: 'hunter2',
},
},
components: {},

View File

@ -2,7 +2,23 @@ import { FromSchema } from 'json-schema-to-ts';
export const dateSchema = {
$id: '#/components/schemas/dateSchema',
oneOf: [{ type: 'string', format: 'date-time' }, { type: 'number' }],
description:
'A representation of a date. Either as a date-time string or as a UNIX timestamp.',
oneOf: [
{
type: 'string',
format: 'date-time',
description:
'An [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339.html)-compliant timestamp.',
example: '2023-07-27T11:23:44Z',
},
{
type: 'integer',
description:
'A [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time).',
example: 1690449593,
},
],
components: {},
} as const;