Skip to content

Commit 515bf0d

Browse files
committed
fix(transition-types): add override for custom_property operationID
1 parent 757eabd commit 515bf0d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

packages/openapi-webhooks-types-transition/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ export type CustomPropertyCreatedEvent =
7171
WebhookEventDefinition<"custom-property-created">;
7272
export type CustomPropertyDeletedEvent =
7373
WebhookEventDefinition<"custom-property-deleted">;
74-
export type CustomPropertyPromoteToEnterpriseEvent =
75-
WebhookEventDefinition<"custom-property-promote-to-enterprise">;
74+
export type CustomPropertyPromotedToEnterpriseEvent =
75+
WebhookEventDefinition<"custom-property-promoted-to-enterprise">;
7676
export type CustomPropertyUpdatedEvent =
7777
WebhookEventDefinition<"custom-property-updated">;
7878
export type CustomPropertyEvent =
7979
| WebhookEventDefinition<"custom-property-created">
8080
| WebhookEventDefinition<"custom-property-deleted">
81-
| WebhookEventDefinition<"custom-property-promote-to-enterprise">
81+
| WebhookEventDefinition<"custom-property-promoted-to-enterprise">
8282
| WebhookEventDefinition<"custom-property-updated">;
8383
export type CustomPropertyValuesEvent =
8484
WebhookEventDefinition<"custom-property-values-updated">;
@@ -757,7 +757,7 @@ export type EventPayloadMap = {
757757
custom_property:
758758
| WebhookEventDefinition<"custom-property-created">
759759
| WebhookEventDefinition<"custom-property-deleted">
760-
| WebhookEventDefinition<"custom-property-promote-to-enterprise">
760+
| WebhookEventDefinition<"custom-property-promoted-to-enterprise">
761761
| WebhookEventDefinition<"custom-property-updated">;
762762
custom_property_values: WebhookEventDefinition<"custom-property-values-updated">;
763763
delete: WebhookEventDefinition<"delete">;

scripts/generate-transition-types.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ async function run() {
3434
for (const webhookDefinitionKey of Object.keys(schema.webhooks)) {
3535
const webhookDefinition = schema.webhooks[webhookDefinitionKey];
3636
const operationDefinition = webhookDefinition.post;
37-
const emitterEventName = operationDefinition.operationId
37+
let emitterEventName = operationDefinition.operationId
3838
.replace(/-/g, "_")
3939
.replace("/", ".");
4040

41+
// Override these specific event names to fix a typo in the OpenAPI spec
42+
if (emitterEventName === "custom_property.promote_to_enterprise") {
43+
emitterEventName = "custom_property.promoted_to_enterprise";
44+
}
45+
4146
const [eventName] = emitterEventName.split(".");
4247

4348
eventsMap[eventName] ||= new Set();

0 commit comments

Comments
 (0)