1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/src/lib/openapi/spec/bootstrap-ui-schema.ts
Tymoteusz Czech 2729999bed
Feat: OpenAPI controller - Bootstrap UI (#1773)
* rename bootstrap ui controller

* sort openapi schema imports

* add bootstrap ui json schema

* test bootstrap ui schema

* openapi bootstrap ui route

* fix: bootstrap ui schema type

* bootstrap ui e2e test

* simplify bootstrap-ui testing mock

* fix: update after review
2022-06-30 12:21:40 +00:00

95 lines
2.6 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
import { uiConfigSchema } from './ui-config-schema';
import { userSchema } from './user-schema';
import { permissionSchema } from './permission-schema';
import { featureTypeSchema } from './feature-type-schema';
import { tagTypeSchema } from './tag-type-schema';
import { contextFieldSchema } from './context-field-schema';
import { strategySchema } from './strategy-schema';
import { projectSchema } from './project-schema';
import { versionSchema } from './version-schema';
import { legalValueSchema } from './legal-value-schema';
export const bootstrapUiSchema = {
$id: '#/components/schemas/bootstrapUiSchema',
type: 'object',
additionalProperties: false,
required: [
'uiConfig',
'user',
'email',
'context',
'featureTypes',
'tagTypes',
'strategies',
'projects',
],
properties: {
uiConfig: {
$ref: '#/components/schemas/uiConfigSchema',
},
user: {
type: 'object',
required: [...userSchema.required],
properties: {
...userSchema.properties,
permissions: {
type: 'array',
items: {
$ref: '#/components/schemas/permissionSchema',
},
},
},
},
email: {
type: 'boolean',
},
context: {
type: 'array',
items: {
$ref: '#/components/schemas/contextFieldSchema',
},
},
featureTypes: {
type: 'array',
items: {
$ref: '#/components/schemas/featureTypeSchema',
},
},
tagTypes: {
type: 'array',
items: {
$ref: '#/components/schemas/tagTypeSchema',
},
},
strategies: {
type: 'array',
items: {
$ref: '#/components/schemas/strategySchema',
},
},
projects: {
type: 'array',
items: {
$ref: '#/components/schemas/projectSchema',
},
},
},
components: {
schemas: {
uiConfigSchema,
userSchema,
permissionSchema,
contextFieldSchema,
featureTypeSchema,
tagTypeSchema,
strategySchema,
projectSchema,
versionSchema,
legalValueSchema,
},
},
} as const;
export type BootstrapUiSchema = FromSchema<typeof bootstrapUiSchema>;