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/features-schema.ts
olav fdebeef929
feat: add OpenAPI validation to a few endpoints (#1409)
* feat: add OpenAPI validation to a few endpoints (2)

* refactor: use package version as the OpenAPI version

* refactor: keep the existing OpenAPI page for now

* refactor: add snapshots tests for the OpenAPI output

* refactor: validate Content-Type by default

* refactor: update vulnerable deps

* refactor: fix documentation URL to match schema

* refactor: improve external type declaration

* refactor: remove unused package resolutions

* refactor: try express-openapi fork

* Update package.json

* Update src/lib/services/openapi-service.ts

* Update src/lib/types/openapi.d.ts

* Update src/lib/types/openapi.d.ts

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-04-25 14:17:59 +02:00

22 lines
521 B
TypeScript

import { createSchemaObject, CreateSchemaType } from '../types';
export const schema = {
type: 'object',
required: ['version', 'features'],
properties: {
version: {
type: 'integer',
},
features: {
type: 'array',
items: {
$ref: '#/components/schemas/featureSchema',
},
},
},
} as const;
export type FeaturesSchema = CreateSchemaType<typeof schema>;
export const featuresSchema = createSchemaObject(schema);