fix: API v2 @GetWebhook() decorator doesn't generate OpenAPI path (#27612)

* fix: openapi spec for GetWebhook decorator

* fix: openapi spec
This commit is contained in:
Rajiv Sahal
2026-02-10 11:56:55 -03:00
committed by GitHub
parent d8e6ecc7a0
commit db76980644
6 changed files with 142 additions and 5 deletions
+8 -1
View File
@@ -7,4 +7,11 @@ GET /v2/bookings/{bookingUid} added 'subschema #3, subschema #6' to the 'data' r
POST /v2/bookings/{bookingUid}/cancel added 'subschema #3, subschema #6' to the 'data' response property 'oneOf' list for the response status '200'
POST /v2/bookings/{bookingUid}/confirm added 'subschema #3, subschema #6' to the 'data' response property 'oneOf' list for the response status '200'
POST /v2/bookings/{bookingUid}/decline added 'subschema #3, subschema #6' to the 'data' response property 'oneOf' list for the response status '200'
POST /v2/bookings/{bookingUid}/guests added 'subschema #3, subschema #6' to the 'data' response property 'oneOf' list for the response status '200'
POST /v2/bookings/{bookingUid}/guests added 'subschema #3, subschema #6' to the 'data' response property 'oneOf' list for the response status '200'
DELETE /v2/event-types/{eventTypeId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
GET /v2/event-types/{eventTypeId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
DELETE /v2/oauth-clients/{clientId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
GET /v2/oauth-clients/{clientId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
DELETE /v2/teams/{teamId}/event-types/{eventTypeId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
GET /v2/teams/{teamId}/event-types/{eventTypeId}/webhooks/{webhookId} added the new path request parameter 'webhookId'
GET /v2/webhooks/{webhookId} added the new path request parameter 'webhookId'
@@ -26,7 +26,7 @@ import {
Patch,
ParseIntPipe,
} from "@nestjs/common";
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -84,6 +84,7 @@ export class EventTypeWebhooksController {
@Get("/:webhookId")
@ApiOperation({ summary: "Get a webhook" })
@ApiParam({ name: "webhookId", type: String, required: true })
async getEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
return {
status: SUCCESS_STATUS,
@@ -116,6 +117,7 @@ export class EventTypeWebhooksController {
@Delete("/:webhookId")
@ApiOperation({ summary: "Delete a webhook" })
@ApiParam({ name: "webhookId", type: String, required: true })
async deleteEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
await this.webhooksService.deleteWebhook(webhook.id);
return {
@@ -3,7 +3,7 @@ import { MembershipRole } from "@calcom/platform-libraries";
import { SkipTakePagination } from "@calcom/platform-types";
import type { Webhook } from "@calcom/prisma/client";
import { Body, Controller, Delete, Get, Param, Patch, Post, Query, UseGuards } from "@nestjs/common";
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
import { MembershipRoles } from "@/modules/auth/decorators/roles/membership-roles.decorator";
@@ -94,6 +94,7 @@ export class OAuthClientWebhooksController {
summary: "Get a webhook",
description: `<Warning>These endpoints are deprecated and will be removed in the future.</Warning>`,
})
@ApiParam({ name: "webhookId", type: String, required: true })
@UseGuards(IsOAuthClientWebhookGuard)
async getOAuthClientWebhook(@GetWebhook() webhook: Webhook): Promise<OAuthClientWebhookOutputResponseDto> {
return {
@@ -135,6 +136,7 @@ export class OAuthClientWebhooksController {
summary: "Delete a webhook",
description: `<Warning>These endpoints are deprecated and will be removed in the future.</Warning>`,
})
@ApiParam({ name: "webhookId", type: String, required: true })
@UseGuards(IsOAuthClientWebhookGuard)
async deleteOAuthClientWebhook(
@GetWebhook() webhook: Webhook
@@ -13,7 +13,7 @@ import {
Query,
UseGuards,
} from "@nestjs/common";
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
import { API_KEY_HEADER } from "@/lib/docs/headers";
@@ -87,6 +87,7 @@ export class TeamsEventTypesWebhooksController {
@Get("/:webhookId")
@ApiOperation({ summary: "Get a webhook for a team event type" })
@ApiParam({ name: "webhookId", type: String, required: true })
@Roles("TEAM_MEMBER")
async getTeamEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
return {
@@ -122,6 +123,7 @@ export class TeamsEventTypesWebhooksController {
@Delete("/:webhookId")
@Roles("TEAM_ADMIN")
@ApiOperation({ summary: "Delete a webhook for a team event type" })
@ApiParam({ name: "webhookId", type: String, required: true })
async deleteTeamEventTypeWebhook(
@GetWebhook() webhook: Webhook
): Promise<EventTypeWebhookOutputResponseDto> {
@@ -16,7 +16,7 @@ import { WebhookOutputPipe } from "@/modules/webhooks/pipes/WebhookOutputPipe";
import { UserWebhooksService } from "@/modules/webhooks/services/user-webhooks.service";
import { WebhooksService } from "@/modules/webhooks/services/webhooks.service";
import { Controller, Post, Body, UseGuards, Get, Param, Query, Delete, Patch } from "@nestjs/common";
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -75,6 +75,7 @@ export class WebhooksController {
@Get("/:webhookId")
@ApiOperation({ summary: "Get a webhook" })
@ApiParam({ name: "webhookId", type: String, required: true })
@UseGuards(IsUserWebhookGuard)
async getWebhook(@GetWebhook() webhook: Webhook): Promise<UserWebhookOutputResponseDto> {
return {
+123
View File
@@ -9326,6 +9326,73 @@
"tags": ["Bookings"]
}
},
"/v2/bookings/by-seat/{seatUid}": {
"get": {
"operationId": "BookingsController_2024_08_13_getBookingBySeatUid",
"summary": "Get a booking by seat UID",
"description": "Get a seated booking by its seat reference UID. This is useful when you have a seatUid from a seated booking and want to retrieve the full booking details.\n\n If you are fetching a seated booking for an event type with 'show attendees' disabled, then to retrieve attendees in the response either set 'show attendees' to true on event type level or\n you have to provide an authentication method of event type owner, host, team admin or owner or org admin or owner.\n\n <Note>Please make sure to pass in the cal-api-version header value as mentioned in the Headers section. Not passing the correct value will default to an older version of this endpoint.</Note>\n ",
"parameters": [
{
"name": "cal-api-version",
"in": "header",
"description": "Must be set to 2024-08-13. If not set to this value, the endpoint will default to an older version.",
"required": true,
"schema": {
"type": "string",
"default": "2024-08-13"
}
},
{
"name": "seatUid",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "value must be `Bearer <token>` where `<token>` is api key prefixed with cal_ or managed user access token",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetBookingOutput_2024_08_13"
}
}
}
}
},
"tags": ["Bookings"]
}
},
"/v2/bookings/{bookingUid}": {
"get": {
"operationId": "BookingsController_2024_08_13_getBooking",
@@ -11593,6 +11660,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -11622,6 +11697,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -12392,6 +12475,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -12420,6 +12511,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -15351,6 +15450,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -15379,6 +15486,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -16665,6 +16780,14 @@
"schema": {
"type": "string"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {