From db7698064407659d86743c29df91618d7afb5178 Mon Sep 17 00:00:00 2001 From: Rajiv Sahal Date: Tue, 10 Feb 2026 20:26:55 +0530 Subject: [PATCH] fix: API v2 `@GetWebhook()` decorator doesn't generate OpenAPI path (#27612) * fix: openapi spec for GetWebhook decorator * fix: openapi spec --- .github/oasdiff-err-ignore.txt | 9 +- .../event-types-webhooks.controller.ts | 4 +- .../oauth-client-webhooks.controller.ts | 4 +- .../teams-event-types-webhooks.controller.ts | 4 +- .../controllers/webhooks.controller.ts | 3 +- docs/api-reference/v2/openapi.json | 123 ++++++++++++++++++ 6 files changed, 142 insertions(+), 5 deletions(-) diff --git a/.github/oasdiff-err-ignore.txt b/.github/oasdiff-err-ignore.txt index b6f23b66e6..634506501b 100644 --- a/.github/oasdiff-err-ignore.txt +++ b/.github/oasdiff-err-ignore.txt @@ -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' \ No newline at end of file +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' diff --git a/apps/api/v2/src/modules/event-types/controllers/event-types-webhooks.controller.ts b/apps/api/v2/src/modules/event-types/controllers/event-types-webhooks.controller.ts index a9e1ef40f9..c96cdab072 100644 --- a/apps/api/v2/src/modules/event-types/controllers/event-types-webhooks.controller.ts +++ b/apps/api/v2/src/modules/event-types/controllers/event-types-webhooks.controller.ts @@ -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 { 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 { await this.webhooksService.deleteWebhook(webhook.id); return { diff --git a/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-webhooks/oauth-client-webhooks.controller.ts b/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-webhooks/oauth-client-webhooks.controller.ts index 23a725ebc2..fa35a0eb93 100644 --- a/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-webhooks/oauth-client-webhooks.controller.ts +++ b/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-webhooks/oauth-client-webhooks.controller.ts @@ -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: `These endpoints are deprecated and will be removed in the future.`, }) + @ApiParam({ name: "webhookId", type: String, required: true }) @UseGuards(IsOAuthClientWebhookGuard) async getOAuthClientWebhook(@GetWebhook() webhook: Webhook): Promise { return { @@ -135,6 +136,7 @@ export class OAuthClientWebhooksController { summary: "Delete a webhook", description: `These endpoints are deprecated and will be removed in the future.`, }) + @ApiParam({ name: "webhookId", type: String, required: true }) @UseGuards(IsOAuthClientWebhookGuard) async deleteOAuthClientWebhook( @GetWebhook() webhook: Webhook diff --git a/apps/api/v2/src/modules/teams/event-types/controllers/teams-event-types-webhooks.controller.ts b/apps/api/v2/src/modules/teams/event-types/controllers/teams-event-types-webhooks.controller.ts index 3afa706fb4..77dab44c91 100644 --- a/apps/api/v2/src/modules/teams/event-types/controllers/teams-event-types-webhooks.controller.ts +++ b/apps/api/v2/src/modules/teams/event-types/controllers/teams-event-types-webhooks.controller.ts @@ -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 { 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 { diff --git a/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.ts b/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.ts index 483bc559b4..8209a10a0f 100644 --- a/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.ts +++ b/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.ts @@ -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 { return { diff --git a/docs/api-reference/v2/openapi.json b/docs/api-reference/v2/openapi.json index 674a910605..007be244f6 100644 --- a/docs/api-reference/v2/openapi.json +++ b/docs/api-reference/v2/openapi.json @@ -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 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.\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 ` where `` 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": {