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/create-api-token-schema.ts

41 lines
1001 B
TypeScript
Raw Normal View History

import { FromSchema } from 'json-schema-to-ts';
import { ApiTokenType } from '../../types/models/api-token';
export const createApiTokenSchema = {
$id: '#/components/schemas/createApiTokenSchema',
type: 'object',
required: ['username', 'type'],
properties: {
secret: {
type: 'string',
},
username: {
type: 'string',
},
type: {
type: 'string',
description: `${Object.values(ApiTokenType).join(', ')}.`,
},
environment: {
type: 'string',
},
project: {
type: 'string',
},
projects: {
type: 'array',
items: {
type: 'string',
},
},
expiresAt: {
type: 'string',
format: 'date-time',
nullable: true,
},
},
components: {},
} as const;
export type CreateApiTokenSchema = FromSchema<typeof createApiTokenSchema>;