1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/openapi/spec/patch-schema.ts
Thomas Heartman 78cf9d03aa
refactor: switch to upstream express-openapi (#5259)
Switch the express-openapi implementation from our internal fork to the
upstream version. We have upstreamed our changes and a new version has
been released, so this should be the last step before we can retire our
fork.

Because some of the dependencies have been updated since our internal
fork, we also need to update some of our error handling to reflect this.
2023-11-06 08:22:02 +01:00

37 lines
1.1 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const patchSchema = {
$id: '#/components/schemas/patchSchema',
type: 'object',
required: ['path', 'op'],
description:
'A [JSON patch](https://www.rfc-editor.org/rfc/rfc6902) operation description',
properties: {
path: {
type: 'string',
description: 'The path to the property to operate on',
example: '/type',
},
op: {
type: 'string',
enum: ['add', 'remove', 'replace', 'copy', 'move'],
description: 'The kind of operation to perform',
example: 'replace',
},
from: {
type: 'string',
description:
'The target to move or copy from, if performing one of those operations',
example: '/type',
},
value: {
description:
'The value to add or replace, if performing one of those operations',
example: 'kill-switch',
},
},
components: {},
} as const;
export type PatchSchema = FromSchema<typeof patchSchema>;