UNPKG

openapi-metadata

Version:

Auto-Generate OpenAPI specifications from Typescript decorators

147 lines (133 loc) 5.92 kB
import { SetOptional } from 'type-fest'; import { O as OperationBodyMetadata, a as OperationParameterMetadata, b as OperationMetadata, P as PropertyMetadata, c as OperationResponseMetadata } from '../shared/openapi-metadata.BeEXIVua.js'; import { a as TypeValue, b as Thunk } from '../shared/openapi-metadata.D34x6L94.js'; import 'openapi-types'; type ApiBodyOptions = SetOptional<OperationBodyMetadata, "mediaType">; /** * Configures the request body. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#request-body-object */ declare function ApiBody(options: ApiBodyOptions): MethodDecorator; type ApiCookieOptions = Omit<OperationParameterMetadata, "in">; /** * Configures a cookie parameter. * Can be applied to Operations and Controllers. * * @see https://swagger.io/specification/#parameter-object */ declare function ApiCookie(options: ApiCookieOptions): (target: Object, propertyKey?: string | symbol) => void; /** * Exclude this Controller from the generated schema. * Useful when working with framework integrations that autoload controllers. */ declare function ApiExcludeController(): ClassDecorator; /** * Exclude this Operation from the generated schema. * Useful when working with framework integrations that autoload controllers. */ declare function ApiExcludeOperation(): MethodDecorator; /** * Adds extra models to the generated schema that are not used anywhere else. * Useful when you want to share models that are not used by your operations. */ declare function ApiExtraModels(...models: (TypeValue | Thunk<TypeValue>)[]): (target: Object) => void; type ApiHeaderOptions = Omit<OperationParameterMetadata, "in">; /** * Configures a header parameter. * Can be applied to Operations and Controllers. * * @see https://swagger.io/specification/#parameter-object */ declare function ApiHeader(options: ApiHeaderOptions): (target: Object, propertyKey?: string | symbol) => void; type ApiOperationOptions = OperationMetadata; /** * Configures a new operation. * When multiple methods are defined, multiple operations will be added to the document. * * @see https://swagger.io/specification/#operation-object */ declare function ApiOperation(options: ApiOperationOptions): MethodDecorator; type ApiParamOptions = Omit<OperationParameterMetadata, "in">; /** * Configures a path parameter. * Can be applied to Operations and Controllers. * * @see https://swagger.io/specification/#parameter-object */ declare function ApiParam(options: ApiParamOptions): (target: Object, propertyKey?: string | symbol) => void; type ApiPropertyOptions = Partial<PropertyMetadata>; /** * Configures this class member as a property of the schema. * Can be applied to properties, getters and methods. * * @see https://swagger.io/specification/#schema-object */ declare function ApiProperty(options?: ApiPropertyOptions): PropertyDecorator; declare function ApiProperty(options?: ApiPropertyOptions): MethodDecorator; /** * Configures this class member as an optional property of the schema. * Can be applied to properties, getters and methods. * * @see https://swagger.io/specification/#schema-object */ declare function ApiPropertyOptional(options?: Omit<ApiPropertyOptions, "required">): PropertyDecorator; declare function ApiPropertyOptional(options?: Omit<ApiPropertyOptions, "required">): MethodDecorator; type ApiQueryOptions = Omit<OperationParameterMetadata, "in">; /** * Configures a query parameter. * Can be applied to Operations and Controllers. * * @see https://swagger.io/specification/#parameter-object */ declare function ApiQuery(options: ApiQueryOptions): (target: Object, propertyKey?: string | symbol) => void; type ApiResponseOptions = SetOptional<OperationResponseMetadata, "status" | "mediaType">; /** * Configures a response. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#response-object */ declare function ApiResponse(options: ApiResponseOptions): (target: Object, propertyKey?: string | symbol) => void; /** * Configures security requirements. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#security-requirement-object */ declare function ApiSecurity(name: string, ...scopes: string[]): (target: Object, propertyKey?: string | symbol) => void; /** * Configures Basic auth security requirement. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#security-requirement-object */ declare function ApiBasicAuth(): (target: Object, propertyKey?: string | symbol) => void; /** * Configures Bearer auth security requirement. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#security-requirement-object */ declare function ApiBearerAuth(): (target: Object, propertyKey?: string | symbol) => void; /** * Configures Cookie auth security requirement. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#security-requirement-object */ declare function ApiCookieAuth(): (target: Object, propertyKey?: string | symbol) => void; /** * Configures OAuth2 auth security requirement. * Can be applied to Controllers and Operations. * * @see https://swagger.io/specification/#security-requirement-object */ declare function ApiOauth2(...scopes: string[]): (target: Object, propertyKey?: string | symbol) => void; /** * Configures tags used to grouping operations. * Can be applied to Controllers and Operations. */ declare function ApiTags(...tags: string[]): (target: Object, propertyKey?: string | symbol) => void; export { ApiBasicAuth, ApiBearerAuth, ApiBody, ApiCookie, ApiCookieAuth, ApiExcludeController, ApiExcludeOperation, ApiExtraModels, ApiHeader, ApiOauth2, ApiOperation, ApiParam, ApiProperty, ApiPropertyOptional, ApiQuery, ApiResponse, ApiSecurity, ApiTags };