mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
In-flight: attempt to simplify event generation
This commit is contained in:
parent
056b8082b2
commit
fc73abdc94
@ -89,43 +89,59 @@ const getEventTypeProperty = (eventType: string) => ({
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
enum: [eventType],
|
enum: [eventType],
|
||||||
description: 'The type of the event.',
|
description: 'The type of the event.',
|
||||||
|
example: eventType,
|
||||||
});
|
});
|
||||||
|
|
||||||
// const createEvent = () => ({
|
type EventData = {
|
||||||
// $id: '#/components/schemas/featureCreatedEventSchema',
|
type: string;
|
||||||
// allOf: [
|
required: string[];
|
||||||
// { $ref: eventBaseSchema.$id },
|
properties: {};
|
||||||
// {
|
description: string;
|
||||||
// type: 'object',
|
};
|
||||||
// additionalProperties: false,
|
const createEvent = (e: EventData) => ({
|
||||||
// required: ['type', ...requiredProps],
|
$id: `#/components/schemas/${e.type}EventSchema`,
|
||||||
// description:
|
|
||||||
// 'This event fires when you create a feature. The `data` property contains the details for the new feature.',
|
|
||||||
// properties: {
|
|
||||||
// type: getEventTypeProperty(eventType),
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// components: {},
|
|
||||||
// })
|
|
||||||
|
|
||||||
export const featureCreatedEventSchema = {
|
|
||||||
$id: '#/components/schemas/featureCreatedEventSchema',
|
|
||||||
allOf: [
|
allOf: [
|
||||||
{ $ref: eventBaseSchema.$id },
|
{ $ref: eventBaseSchema.$id },
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['type'],
|
required: ['type', ...e.required],
|
||||||
description:
|
description:
|
||||||
'This event fires when you create a feature. The `data` property contains the details for the new feature.',
|
'This event fires when you create a feature. The `data` property contains the details for the new feature.',
|
||||||
properties: {
|
properties: {
|
||||||
type: getEventTypeProperty(FEATURE_CREATED),
|
type: getEventTypeProperty(e.type),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
components: {},
|
components: {},
|
||||||
};
|
});
|
||||||
|
|
||||||
|
export const featureCreatedEventSchema = createEvent({
|
||||||
|
type: FEATURE_CREATED,
|
||||||
|
description: 'blu',
|
||||||
|
required: ['other prop'],
|
||||||
|
properties: {
|
||||||
|
'other prop': { type: 'string' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// export const featureCreatedEventSchema = {
|
||||||
|
// $id: '#/components/schemas/featureCreatedEventSchema',
|
||||||
|
// allOf: [
|
||||||
|
// { $ref: eventBaseSchema.$id },
|
||||||
|
// {
|
||||||
|
// type: 'object',
|
||||||
|
// additionalProperties: false,
|
||||||
|
// required: ['type'],
|
||||||
|
// description:
|
||||||
|
// 'This event fires when you create a feature. The `data` property contains the details for the new feature.',
|
||||||
|
// properties: {
|
||||||
|
// type: getEventTypeProperty(FEATURE_CREATED),
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// components: {},
|
||||||
|
// };
|
||||||
|
|
||||||
export const featureUpdatedEventSchema = {
|
export const featureUpdatedEventSchema = {
|
||||||
$id: '#/components/schemas/featureUpdatedEventSchema',
|
$id: '#/components/schemas/featureUpdatedEventSchema',
|
||||||
|
Loading…
Reference in New Issue
Block a user