fix(api): add @ApiExtraModels for location types in OpenAPI spec (#26951)
The UpdateInputAddressLocation_2024_08_13 and related location types were referenced via getSchemaPath() but not registered with @ApiExtraModels, causing them to be missing from the generated OpenAPI spec. This fix adds @ApiExtraModels decorator to the BookingLocationController to register all location types used in the UpdateBookingLocationInput. Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -9,10 +9,18 @@ import { ApiAuthGuard } from "@/modules/auth/guards/api-auth/api-auth.guard";
|
||||
import { PermissionsGuard } from "@/modules/auth/guards/permissions/permissions.guard";
|
||||
import { ApiAuthGuardUser } from "@/modules/auth/strategies/api-auth/api-auth.strategy";
|
||||
import { Controller, Patch, Logger, Body, UseGuards, Param, HttpCode, HttpStatus } from "@nestjs/common";
|
||||
import { ApiOperation, ApiTags as DocsTags, ApiHeader } from "@nestjs/swagger";
|
||||
import { ApiExtraModels, ApiOperation, ApiTags as DocsTags, ApiHeader } from "@nestjs/swagger";
|
||||
|
||||
import { BOOKING_WRITE, SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import { UpdateBookingLocationInput_2024_08_13 } from "@calcom/platform-types";
|
||||
import {
|
||||
UpdateBookingLocationInput_2024_08_13,
|
||||
UpdateInputAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeDefinedLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeePhoneLocation_2024_08_13,
|
||||
UpdateBookingInputLinkLocation_2024_08_13,
|
||||
UpdateBookingInputPhoneLocation_2024_08_13,
|
||||
} from "@calcom/platform-types";
|
||||
|
||||
@Controller({
|
||||
path: "/v2/bookings/:bookingUid/location",
|
||||
@@ -20,6 +28,14 @@ import { UpdateBookingLocationInput_2024_08_13 } from "@calcom/platform-types";
|
||||
})
|
||||
@UseGuards(PermissionsGuard)
|
||||
@DocsTags("Bookings")
|
||||
@ApiExtraModels(
|
||||
UpdateInputAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeDefinedLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeePhoneLocation_2024_08_13,
|
||||
UpdateBookingInputLinkLocation_2024_08_13,
|
||||
UpdateBookingInputPhoneLocation_2024_08_13
|
||||
)
|
||||
@ApiHeader({
|
||||
name: "cal-api-version",
|
||||
description: `Must be set to ${VERSION_2024_08_13}. This header is required as this endpoint does not exist in older API versions.`,
|
||||
|
||||
+327
-207
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import { ApiPropertyOptional, getSchemaPath } from "@nestjs/swagger";
|
||||
import { ApiExtraModels, ApiPropertyOptional, getSchemaPath } from "@nestjs/swagger";
|
||||
import { ApiProperty as DocsProperty } from "@nestjs/swagger";
|
||||
import { plainToInstance } from "class-transformer";
|
||||
import { IsOptional } from "class-validator";
|
||||
@@ -109,6 +109,14 @@ export function ValidateUpdateBookingLocation_2024_08_13(validationOptions?: Val
|
||||
};
|
||||
}
|
||||
|
||||
@ApiExtraModels(
|
||||
UpdateInputAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeAddressLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeeDefinedLocation_2024_08_13,
|
||||
UpdateBookingInputAttendeePhoneLocation_2024_08_13,
|
||||
UpdateBookingInputLinkLocation_2024_08_13,
|
||||
UpdateBookingInputPhoneLocation_2024_08_13
|
||||
)
|
||||
export class UpdateBookingLocationInput_2024_08_13 {
|
||||
@IsOptional()
|
||||
@ValidateUpdateBookingLocation_2024_08_13()
|
||||
|
||||
Reference in New Issue
Block a user