Scheduling infrastructure for absolutely everyone.
fix: API v2 `@GetWebhook()` decorator doesn't generate OpenAPI path (#27612)
Rajiv Sahaldb7698064407
diff --git a/.github/oasdiff-err-ignore.txt b/.github/oasdiff-err-ignore.txtindex b6f23b66e63..634506501bf 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' rPOST /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.tsindex a9e1ef40f97..c96cdab0726 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<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 {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.tsindex 23a725ebc29..fa35a0eb93e 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: `<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: Webhookdiff --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.tsindex 3afa706fb4a..77dab44c918 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<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> {diff --git a/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.ts b/apps/api/v2/src/modules/webhooks/controllers/webhooks.controller.tsindex 483bc559b49..8209a10a0f3 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<UserWebhookOutputResponseDto> {return {diff --git a/docs/api-reference/v2/openapi.json b/docs/api-reference/v2/openapi.jsonindex 674a9106054..007be244f68 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 <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": {