1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-24 01:18:01 +02:00
unleash.unleash/src/lib/openapi/spec/patch-schema.ts
Thomas Heartman 0dd5d0faa1 #1391: modify patch schema to specify either object or array
We don't provide many patch endpoints, so we _could_ create separate
patch operation objects for each one. I think that makes sense to do
as part of the larger cleanup. For now, I think it's worth to simply
turn it into one of these. While it's not entirely accurate, it's
better than what we had before.
2022-09-14 12:33:57 +02:00

31 lines
715 B
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const patchSchema = {
$id: '#/components/schemas/patchSchema',
type: 'object',
required: ['path', 'op'],
properties: {
path: {
type: 'string',
},
op: {
type: 'string',
enum: ['add', 'remove', 'replace', 'copy', 'move'],
},
from: {
type: 'string',
},
value: {
oneOf: [
{
type: 'object',
},
{ type: 'array', items: { type: 'object' } },
],
},
},
components: {},
} as const;
export type PatchSchema = FromSchema<typeof patchSchema>;