@nestjs/swagger

  • Version 5.0.9
  • Published
  • 232 kB
  • 3 dependencies
  • MIT license

Install

npm i @nestjs/swagger
yarn add @nestjs/swagger
pnpm add @nestjs/swagger

Overview

Nest - modern, fast, powerful node.js web framework (@swagger)

Index

Functions

Classes

Interfaces

Type Aliases

Functions

function ApiAcceptedResponse

ApiAcceptedResponse: (
options?: ApiResponseOptions
) => MethodDecorator & ClassDecorator;

    function ApiBadGatewayResponse

    ApiBadGatewayResponse: (
    options?: ApiResponseOptions
    ) => MethodDecorator & ClassDecorator;

      function ApiBadRequestResponse

      ApiBadRequestResponse: (
      options?: ApiResponseOptions
      ) => MethodDecorator & ClassDecorator;

        function ApiBasicAuth

        ApiBasicAuth: (name?: string) => ClassDecorator & MethodDecorator;

          function ApiBearerAuth

          ApiBearerAuth: (name?: string) => ClassDecorator & MethodDecorator;

            function ApiBody

            ApiBody: (options: ApiBodyOptions) => MethodDecorator;

              function ApiConflictResponse

              ApiConflictResponse: (
              options?: ApiResponseOptions
              ) => MethodDecorator & ClassDecorator;

                function ApiConsumes

                ApiConsumes: (...mimeTypes: string[]) => MethodDecorator & ClassDecorator;

                  function ApiCookieAuth

                  ApiCookieAuth: (name?: string) => ClassDecorator & MethodDecorator;

                    function ApiCreatedResponse

                    ApiCreatedResponse: (
                    options?: ApiResponseOptions
                    ) => MethodDecorator & ClassDecorator;

                      function ApiDefaultResponse

                      ApiDefaultResponse: (
                      options?: ApiResponseOptions
                      ) => MethodDecorator & ClassDecorator;

                        function ApiExcludeController

                        ApiExcludeController: (disable?: boolean) => ClassDecorator;

                          function ApiExcludeEndpoint

                          ApiExcludeEndpoint: (disable?: boolean) => MethodDecorator;

                            function ApiExtension

                            ApiExtension: (
                            extensionKey: string,
                            extensionProperties: any
                            ) => MethodDecorator & ClassDecorator;

                              function ApiExtraModels

                              ApiExtraModels: (
                              ...models: Function[]
                              ) => (
                              target: object,
                              key?: string | symbol,
                              descriptor?: TypedPropertyDescriptor<any>
                              ) => any;

                                function ApiForbiddenResponse

                                ApiForbiddenResponse: (
                                options?: ApiResponseOptions
                                ) => MethodDecorator & ClassDecorator;

                                  function ApiFoundResponse

                                  ApiFoundResponse: (
                                  options?: ApiResponseOptions
                                  ) => MethodDecorator & ClassDecorator;

                                    function ApiGatewayTimeoutResponse

                                    ApiGatewayTimeoutResponse: (
                                    options?: ApiResponseOptions
                                    ) => MethodDecorator & ClassDecorator;

                                      function ApiGoneResponse

                                      ApiGoneResponse: (
                                      options?: ApiResponseOptions
                                      ) => MethodDecorator & ClassDecorator;

                                        function ApiHeader

                                        ApiHeader: (options: ApiHeaderOptions) => MethodDecorator & ClassDecorator;

                                          function ApiHeaders

                                          ApiHeaders: (headers: ApiHeaderOptions[]) => MethodDecorator & ClassDecorator;

                                            function ApiHideProperty

                                            ApiHideProperty: () => PropertyDecorator;

                                              function ApiInternalServerErrorResponse

                                              ApiInternalServerErrorResponse: (
                                              options?: ApiResponseOptions
                                              ) => MethodDecorator & ClassDecorator;

                                                function ApiMethodNotAllowedResponse

                                                ApiMethodNotAllowedResponse: (
                                                options?: ApiResponseOptions
                                                ) => MethodDecorator & ClassDecorator;

                                                  function ApiMovedPermanentlyResponse

                                                  ApiMovedPermanentlyResponse: (
                                                  options?: ApiResponseOptions
                                                  ) => MethodDecorator & ClassDecorator;

                                                    function ApiNoContentResponse

                                                    ApiNoContentResponse: (
                                                    options?: ApiResponseOptions
                                                    ) => MethodDecorator & ClassDecorator;

                                                      function ApiNotAcceptableResponse

                                                      ApiNotAcceptableResponse: (
                                                      options?: ApiResponseOptions
                                                      ) => MethodDecorator & ClassDecorator;

                                                        function ApiNotFoundResponse

                                                        ApiNotFoundResponse: (
                                                        options?: ApiResponseOptions
                                                        ) => MethodDecorator & ClassDecorator;

                                                          function ApiNotImplementedResponse

                                                          ApiNotImplementedResponse: (
                                                          options?: ApiResponseOptions
                                                          ) => MethodDecorator & ClassDecorator;

                                                            function ApiOAuth2

                                                            ApiOAuth2: (scopes: string[], name?: string) => ClassDecorator & MethodDecorator;

                                                              function ApiOkResponse

                                                              ApiOkResponse: (
                                                              options?: ApiResponseOptions
                                                              ) => MethodDecorator & ClassDecorator;

                                                                function ApiOperation

                                                                ApiOperation: (options: ApiOperationOptions) => MethodDecorator;

                                                                  function ApiParam

                                                                  ApiParam: (options: ApiParamOptions) => MethodDecorator;

                                                                    function ApiPayloadTooLargeResponse

                                                                    ApiPayloadTooLargeResponse: (
                                                                    options?: ApiResponseOptions
                                                                    ) => MethodDecorator & ClassDecorator;

                                                                      function ApiPreconditionFailedResponse

                                                                      ApiPreconditionFailedResponse: (
                                                                      options?: ApiResponseOptions
                                                                      ) => MethodDecorator & ClassDecorator;

                                                                        function ApiProduces

                                                                        ApiProduces: (...mimeTypes: string[]) => MethodDecorator & ClassDecorator;

                                                                          function ApiProperty

                                                                          ApiProperty: (options?: ApiPropertyOptions) => PropertyDecorator;

                                                                            function ApiPropertyOptional

                                                                            ApiPropertyOptional: (options?: ApiPropertyOptions) => PropertyDecorator;

                                                                              function ApiQuery

                                                                              ApiQuery: (options: ApiQueryOptions) => MethodDecorator;

                                                                                function ApiRequestTimeoutResponse

                                                                                ApiRequestTimeoutResponse: (
                                                                                options?: ApiResponseOptions
                                                                                ) => MethodDecorator & ClassDecorator;

                                                                                  function ApiResponse

                                                                                  ApiResponse: (options: ApiResponseOptions) => MethodDecorator & ClassDecorator;

                                                                                    function ApiResponseProperty

                                                                                    ApiResponseProperty: (
                                                                                    options?: Pick<
                                                                                    ApiPropertyOptions,
                                                                                    'type' | 'example' | 'format' | 'enum' | 'deprecated'
                                                                                    >
                                                                                    ) => PropertyDecorator;

                                                                                      function ApiSecurity

                                                                                      ApiSecurity: (
                                                                                      name: string | SecurityRequirementObject,
                                                                                      requirements?: string[]
                                                                                      ) => ClassDecorator & MethodDecorator;

                                                                                        function ApiServiceUnavailableResponse

                                                                                        ApiServiceUnavailableResponse: (
                                                                                        options?: ApiResponseOptions
                                                                                        ) => MethodDecorator & ClassDecorator;

                                                                                          function ApiTags

                                                                                          ApiTags: (...tags: string[]) => MethodDecorator & ClassDecorator;

                                                                                            function ApiTooManyRequestsResponse

                                                                                            ApiTooManyRequestsResponse: (
                                                                                            options?: ApiResponseOptions
                                                                                            ) => MethodDecorator & ClassDecorator;

                                                                                              function ApiUnauthorizedResponse

                                                                                              ApiUnauthorizedResponse: (
                                                                                              options?: ApiResponseOptions
                                                                                              ) => MethodDecorator & ClassDecorator;

                                                                                                function ApiUnprocessableEntityResponse

                                                                                                ApiUnprocessableEntityResponse: (
                                                                                                options?: ApiResponseOptions
                                                                                                ) => MethodDecorator & ClassDecorator;

                                                                                                  function ApiUnsupportedMediaTypeResponse

                                                                                                  ApiUnsupportedMediaTypeResponse: (
                                                                                                  options?: ApiResponseOptions
                                                                                                  ) => MethodDecorator & ClassDecorator;

                                                                                                    function getSchemaPath

                                                                                                    getSchemaPath: (model: string | Function) => string;

                                                                                                      function IntersectionType

                                                                                                      IntersectionType: <A, B>(classARef: any, classBRef: any) => any;

                                                                                                        function OmitType

                                                                                                        OmitType: <T, K extends keyof T>(classRef: any, keys: readonly K[]) => any;

                                                                                                          function PartialType

                                                                                                          PartialType: <T>(classRef: any) => any;

                                                                                                            function PickType

                                                                                                            PickType: <T, K extends keyof T>(classRef: any, keys: readonly K[]) => any;

                                                                                                              function refs

                                                                                                              refs: (...models: Function[]) => { $ref: string }[];

                                                                                                                Classes

                                                                                                                class DocumentBuilder

                                                                                                                class DocumentBuilder {}

                                                                                                                  method addApiKey

                                                                                                                  addApiKey: (options?: SecuritySchemeObject, name?: string) => this;

                                                                                                                    method addBasicAuth

                                                                                                                    addBasicAuth: (options?: SecuritySchemeObject, name?: string) => this;

                                                                                                                      method addBearerAuth

                                                                                                                      addBearerAuth: (options?: SecuritySchemeObject, name?: string) => this;

                                                                                                                        method addCookieAuth

                                                                                                                        addCookieAuth: (
                                                                                                                        cookieName?: string,
                                                                                                                        options?: SecuritySchemeObject,
                                                                                                                        securityName?: string
                                                                                                                        ) => this;

                                                                                                                          method addOAuth2

                                                                                                                          addOAuth2: (options?: SecuritySchemeObject, name?: string) => this;

                                                                                                                            method addSecurity

                                                                                                                            addSecurity: (name: string, options: SecuritySchemeObject) => this;

                                                                                                                              method addSecurityRequirements

                                                                                                                              addSecurityRequirements: (
                                                                                                                              name: string | SecurityRequirementObject,
                                                                                                                              requirements?: string[]
                                                                                                                              ) => this;

                                                                                                                                method addServer

                                                                                                                                addServer: (
                                                                                                                                url: string,
                                                                                                                                description?: string,
                                                                                                                                variables?: Record<string, ServerVariableObject>
                                                                                                                                ) => this;

                                                                                                                                  method addTag

                                                                                                                                  addTag: (
                                                                                                                                  name: string,
                                                                                                                                  description?: string,
                                                                                                                                  externalDocs?: ExternalDocumentationObject
                                                                                                                                  ) => this;

                                                                                                                                    method build

                                                                                                                                    build: () => Omit<OpenAPIObject, 'paths'>;

                                                                                                                                      method setBasePath

                                                                                                                                      setBasePath: (path: string) => this;

                                                                                                                                        method setContact

                                                                                                                                        setContact: (name: string, url: string, email: string) => this;

                                                                                                                                          method setDescription

                                                                                                                                          setDescription: (description: string) => this;

                                                                                                                                            method setExternalDoc

                                                                                                                                            setExternalDoc: (description: string, url: string) => this;

                                                                                                                                              method setLicense

                                                                                                                                              setLicense: (name: string, url: string) => this;

                                                                                                                                                method setTermsOfService

                                                                                                                                                setTermsOfService: (termsOfService: string) => this;

                                                                                                                                                  method setTitle

                                                                                                                                                  setTitle: (title: string) => this;

                                                                                                                                                    method setVersion

                                                                                                                                                    setVersion: (version: string) => this;

                                                                                                                                                      class SwaggerModule

                                                                                                                                                      class SwaggerModule {}

                                                                                                                                                        method createDocument

                                                                                                                                                        static createDocument: (
                                                                                                                                                        app: any,
                                                                                                                                                        config: Omit<OpenAPIObject, 'paths'>,
                                                                                                                                                        options?: SwaggerDocumentOptions
                                                                                                                                                        ) => OpenAPIObject;

                                                                                                                                                          method setup

                                                                                                                                                          static setup: (
                                                                                                                                                          path: string,
                                                                                                                                                          app: any,
                                                                                                                                                          document: OpenAPIObject,
                                                                                                                                                          options?: SwaggerCustomOptions
                                                                                                                                                          ) => void;

                                                                                                                                                            Interfaces

                                                                                                                                                            interface ApiHeaderOptions

                                                                                                                                                            interface ApiHeaderOptions extends Omit<ParameterObject, 'in'> {}

                                                                                                                                                              property enum

                                                                                                                                                              enum?: SwaggerEnumType;

                                                                                                                                                                interface ApiPropertyOptions

                                                                                                                                                                interface ApiPropertyOptions extends Omit<SchemaObjectMetadata, 'name' | 'enum'> {}

                                                                                                                                                                  property enum

                                                                                                                                                                  enum?: any[] | Record<string, any>;

                                                                                                                                                                    property enumName

                                                                                                                                                                    enumName?: string;

                                                                                                                                                                      property name

                                                                                                                                                                      name?: string;

                                                                                                                                                                        interface ApiResponseMetadata

                                                                                                                                                                        interface ApiResponseMetadata extends Omit<ResponseObject, 'description'> {}

                                                                                                                                                                          property description

                                                                                                                                                                          description?: string;

                                                                                                                                                                            property isArray

                                                                                                                                                                            isArray?: boolean;

                                                                                                                                                                              property status

                                                                                                                                                                              status?: number | 'default';

                                                                                                                                                                                property type

                                                                                                                                                                                type?: Type<unknown> | Function | [Function] | string;

                                                                                                                                                                                  interface ApiResponseSchemaHost

                                                                                                                                                                                  interface ApiResponseSchemaHost extends Omit<ResponseObject, 'description'> {}

                                                                                                                                                                                    property description

                                                                                                                                                                                    description?: string;

                                                                                                                                                                                      property schema

                                                                                                                                                                                      schema: SchemaObject & Partial<ReferenceObject>;

                                                                                                                                                                                        property status

                                                                                                                                                                                        status?: number;

                                                                                                                                                                                          interface ExpressSwaggerCustomOptions

                                                                                                                                                                                          interface ExpressSwaggerCustomOptions {}

                                                                                                                                                                                            property customCss

                                                                                                                                                                                            customCss?: string;

                                                                                                                                                                                              property customCssUrl

                                                                                                                                                                                              customCssUrl?: string;

                                                                                                                                                                                                property customfavIcon

                                                                                                                                                                                                customfavIcon?: string;

                                                                                                                                                                                                  property customJs

                                                                                                                                                                                                  customJs?: string;

                                                                                                                                                                                                    property customSiteTitle

                                                                                                                                                                                                    customSiteTitle?: string;

                                                                                                                                                                                                      property explorer

                                                                                                                                                                                                      explorer?: boolean;

                                                                                                                                                                                                        property swaggerOptions

                                                                                                                                                                                                        swaggerOptions?: Record<string, any>;

                                                                                                                                                                                                          property swaggerUrl

                                                                                                                                                                                                          swaggerUrl?: string;

                                                                                                                                                                                                            property url

                                                                                                                                                                                                            url?: string;

                                                                                                                                                                                                              property urls

                                                                                                                                                                                                              urls?: Record<'url' | 'name', string>[];

                                                                                                                                                                                                                property validatorUrl

                                                                                                                                                                                                                validatorUrl?: string;

                                                                                                                                                                                                                  interface FastifySwaggerCustomOptions

                                                                                                                                                                                                                  interface FastifySwaggerCustomOptions {}

                                                                                                                                                                                                                    property uiConfig

                                                                                                                                                                                                                    uiConfig?: Record<string, any>;

                                                                                                                                                                                                                      interface OpenAPIObject

                                                                                                                                                                                                                      interface OpenAPIObject {}

                                                                                                                                                                                                                        property components

                                                                                                                                                                                                                        components?: ComponentsObject;

                                                                                                                                                                                                                          property externalDocs

                                                                                                                                                                                                                          externalDocs?: ExternalDocumentationObject;

                                                                                                                                                                                                                            property info

                                                                                                                                                                                                                            info: InfoObject;

                                                                                                                                                                                                                              property openapi

                                                                                                                                                                                                                              openapi: string;

                                                                                                                                                                                                                                property paths

                                                                                                                                                                                                                                paths: PathsObject;

                                                                                                                                                                                                                                  property security

                                                                                                                                                                                                                                  security?: SecurityRequirementObject[];

                                                                                                                                                                                                                                    property servers

                                                                                                                                                                                                                                    servers?: ServerObject[];

                                                                                                                                                                                                                                      property tags

                                                                                                                                                                                                                                      tags?: TagObject[];

                                                                                                                                                                                                                                        interface SwaggerDocumentOptions

                                                                                                                                                                                                                                        interface SwaggerDocumentOptions {}

                                                                                                                                                                                                                                          property deepScanRoutes

                                                                                                                                                                                                                                          deepScanRoutes?: boolean;

                                                                                                                                                                                                                                            property extraModels

                                                                                                                                                                                                                                            extraModels?: Function[];

                                                                                                                                                                                                                                              property ignoreGlobalPrefix

                                                                                                                                                                                                                                              ignoreGlobalPrefix?: boolean;

                                                                                                                                                                                                                                                property include

                                                                                                                                                                                                                                                include?: Function[];

                                                                                                                                                                                                                                                  property operationIdFactory

                                                                                                                                                                                                                                                  operationIdFactory?: (controllerKey: string, methodKey: string) => string;

                                                                                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                                                                                    type ApiBodyOptions

                                                                                                                                                                                                                                                    type ApiBodyOptions = ApiBodyMetadata | ApiBodySchemaHost;

                                                                                                                                                                                                                                                      type ApiOperationOptions

                                                                                                                                                                                                                                                      type ApiOperationOptions = Partial<OperationObject>;

                                                                                                                                                                                                                                                        type ApiParamOptions

                                                                                                                                                                                                                                                        type ApiParamOptions = ApiParamMetadata | ApiParamSchemaHost;

                                                                                                                                                                                                                                                          type ApiQueryOptions

                                                                                                                                                                                                                                                          type ApiQueryOptions = ApiQueryMetadata | ApiQuerySchemaHost;

                                                                                                                                                                                                                                                            type ApiResponseOptions

                                                                                                                                                                                                                                                            type ApiResponseOptions = ApiResponseMetadata | ApiResponseSchemaHost;

                                                                                                                                                                                                                                                              type SwaggerCustomOptions

                                                                                                                                                                                                                                                              type SwaggerCustomOptions =
                                                                                                                                                                                                                                                              | FastifySwaggerCustomOptions
                                                                                                                                                                                                                                                              | ExpressSwaggerCustomOptions;

                                                                                                                                                                                                                                                                Package Files (31)

                                                                                                                                                                                                                                                                Dependencies (3)

                                                                                                                                                                                                                                                                Dev Dependencies (28)

                                                                                                                                                                                                                                                                Peer Dependencies (5)

                                                                                                                                                                                                                                                                Badge

                                                                                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/swagger.

                                                                                                                                                                                                                                                                • Markdown
                                                                                                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/swagger)
                                                                                                                                                                                                                                                                • HTML
                                                                                                                                                                                                                                                                  <a href="https://www.jsdocs.io/package/@nestjs/swagger"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>