@nestjs/swagger

  • Version 11.4.4
  • Published
  • 432 kB
  • 6 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

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable DECORATORS

const DECORATORS: {
API_OPERATION: string;
API_RESPONSE: string;
API_PRODUCES: string;
API_CONSUMES: string;
API_TAGS: string;
API_WEBHOOK: string;
API_CALLBACKS: string;
API_PARAMETERS: string;
API_HEADERS: string;
API_MODEL_PROPERTIES: string;
API_MODEL_PROPERTIES_ARRAY: string;
API_SECURITY: string;
API_EXCLUDE_ENDPOINT: string;
API_INCLUDE_ENDPOINT: string;
API_EXCLUDE_CONTROLLER: string;
API_EXTRA_MODELS: string;
API_EXTENSION: string;
API_SCHEMA: string;
API_DEFAULT_GETTER: string;
API_LINK: string;
};

    variable DECORATORS_PREFIX

    const DECORATORS_PREFIX: string;

      Functions

      function ApiAcceptedResponse

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

        function ApiAmbiguousResponse

        ApiAmbiguousResponse: (
        options?: ApiResponseNoStatusOptions
        ) => MethodDecorator & ClassDecorator;

          function ApiBadGatewayResponse

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

            function ApiBadRequestResponse

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

              function ApiBasicAuth

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

                function ApiBearerAuth

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

                  function ApiBody

                  ApiBody: (options: ApiBodyOptions) => MethodDecorator;

                    function ApiCallbacks

                    ApiCallbacks: (
                    ...callbackObject: Array<CallBackObject<any>>
                    ) => MethodDecorator & ClassDecorator;

                      function ApiConflictResponse

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

                        function ApiConsumes

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

                          function ApiContinueResponse

                          ApiContinueResponse: (
                          options?: ApiResponseNoStatusOptions
                          ) => MethodDecorator & ClassDecorator;

                            function ApiCookieAuth

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

                              function ApiCreatedResponse

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

                                function ApiDefaultGetter

                                ApiDefaultGetter: (
                                type: Type<unknown> | Function,
                                parameter: string
                                ) => MethodDecorator;

                                  function ApiDefaultResponse

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

                                    function ApiEarlyhintsResponse

                                    ApiEarlyhintsResponse: (
                                    options?: ApiResponseNoStatusOptions
                                    ) => MethodDecorator & ClassDecorator;

                                      function ApiExcludeController

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

                                        function ApiExcludeEndpoint

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

                                          function ApiExpectationFailedResponse

                                          ApiExpectationFailedResponse: (
                                          options?: ApiResponseNoStatusOptions
                                          ) => MethodDecorator & ClassDecorator;

                                            function ApiExtension

                                            ApiExtension: (
                                            extensionKey: string,
                                            extensionProperties: any
                                            ) => (
                                            target: object | Function,
                                            key?: string | symbol,
                                            descriptor?: TypedPropertyDescriptor<any>
                                            ) => any;

                                              function ApiExtraModels

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

                                                function ApiFailedDependencyResponse

                                                ApiFailedDependencyResponse: (
                                                options?: ApiResponseNoStatusOptions
                                                ) => MethodDecorator & ClassDecorator;

                                                  function ApiForbiddenResponse

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

                                                    function ApiFoundResponse

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

                                                      function ApiGatewayTimeoutResponse

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

                                                        function ApiGoneResponse

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

                                                          function ApiHeader

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

                                                            function ApiHeaders

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

                                                              function ApiHideProperty

                                                              ApiHideProperty: () => PropertyDecorator;

                                                                function ApiHttpVersionNotSupportedResponse

                                                                ApiHttpVersionNotSupportedResponse: (
                                                                options?: ApiResponseNoStatusOptions
                                                                ) => MethodDecorator & ClassDecorator;

                                                                  function ApiIAmATeapotResponse

                                                                  ApiIAmATeapotResponse: (
                                                                  options?: ApiResponseNoStatusOptions
                                                                  ) => MethodDecorator & ClassDecorator;

                                                                    function ApiIncludeEndpoint

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

                                                                      function ApiInternalServerErrorResponse

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

                                                                        function ApiLengthRequiredResponse

                                                                        ApiLengthRequiredResponse: (
                                                                        options?: ApiResponseNoStatusOptions
                                                                        ) => MethodDecorator & ClassDecorator;
                                                                          ApiLink: ({ from, fromField, routeParam }: ApiLinkOptions) => MethodDecorator;

                                                                            function ApiMethodNotAllowedResponse

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

                                                                              function ApiMisdirectedResponse

                                                                              ApiMisdirectedResponse: (
                                                                              options?: ApiResponseNoStatusOptions
                                                                              ) => MethodDecorator & ClassDecorator;

                                                                                function ApiMovedPermanentlyResponse

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

                                                                                  function ApiNoContentResponse

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

                                                                                    function ApiNonAuthoritativeInformationResponse

                                                                                    ApiNonAuthoritativeInformationResponse: (
                                                                                    options?: ApiResponseNoStatusOptions
                                                                                    ) => MethodDecorator & ClassDecorator;

                                                                                      function ApiNotAcceptableResponse

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

                                                                                        function ApiNotFoundResponse

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

                                                                                          function ApiNotImplementedResponse

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

                                                                                            function ApiNotModifiedResponse

                                                                                            ApiNotModifiedResponse: (
                                                                                            options?: ApiResponseNoStatusOptions
                                                                                            ) => MethodDecorator & ClassDecorator;

                                                                                              function ApiOAuth2

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

                                                                                                function ApiOkResponse

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

                                                                                                  function ApiOperation

                                                                                                  ApiOperation: (
                                                                                                  options: ApiOperationOptions,
                                                                                                  { overrideExisting }?: { overrideExisting: boolean }
                                                                                                  ) => MethodDecorator;

                                                                                                    function ApiParam

                                                                                                    ApiParam: (options: ApiParamOptions) => MethodDecorator & ClassDecorator;

                                                                                                      function ApiPartialContentResponse

                                                                                                      ApiPartialContentResponse: (
                                                                                                      options?: ApiResponseNoStatusOptions
                                                                                                      ) => MethodDecorator & ClassDecorator;

                                                                                                        function ApiPayloadTooLargeResponse

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

                                                                                                          function ApiPaymentRequiredResponse

                                                                                                          ApiPaymentRequiredResponse: (
                                                                                                          options?: ApiResponseNoStatusOptions
                                                                                                          ) => MethodDecorator & ClassDecorator;

                                                                                                            function ApiPermanentRedirectResponse

                                                                                                            ApiPermanentRedirectResponse: (
                                                                                                            options?: ApiResponseNoStatusOptions
                                                                                                            ) => MethodDecorator & ClassDecorator;

                                                                                                              function ApiPreconditionFailedResponse

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

                                                                                                                function ApiPreconditionRequiredResponse

                                                                                                                ApiPreconditionRequiredResponse: (
                                                                                                                options?: ApiResponseNoStatusOptions
                                                                                                                ) => MethodDecorator & ClassDecorator;

                                                                                                                  function ApiProcessingResponse

                                                                                                                  ApiProcessingResponse: (
                                                                                                                  options?: ApiResponseNoStatusOptions
                                                                                                                  ) => MethodDecorator & ClassDecorator;

                                                                                                                    function ApiProduces

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

                                                                                                                      function ApiProperty

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

                                                                                                                        function ApiPropertyOptional

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

                                                                                                                          function ApiProxyAuthenticationRequiredResponse

                                                                                                                          ApiProxyAuthenticationRequiredResponse: (
                                                                                                                          options?: ApiResponseNoStatusOptions
                                                                                                                          ) => MethodDecorator & ClassDecorator;

                                                                                                                            function ApiQuery

                                                                                                                            ApiQuery: (options: ApiQueryOptions) => MethodDecorator & ClassDecorator;

                                                                                                                              function ApiRequestedRangeNotSatisfiableResponse

                                                                                                                              ApiRequestedRangeNotSatisfiableResponse: (
                                                                                                                              options?: ApiResponseNoStatusOptions
                                                                                                                              ) => MethodDecorator & ClassDecorator;

                                                                                                                                function ApiRequestTimeoutResponse

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

                                                                                                                                  function ApiResetContentResponse

                                                                                                                                  ApiResetContentResponse: (
                                                                                                                                  options?: ApiResponseNoStatusOptions
                                                                                                                                  ) => MethodDecorator & ClassDecorator;

                                                                                                                                    function ApiResponse

                                                                                                                                    ApiResponse: (
                                                                                                                                    options: ApiResponseOptions,
                                                                                                                                    { overrideExisting }?: { overrideExisting: boolean }
                                                                                                                                    ) => MethodDecorator & ClassDecorator;

                                                                                                                                      function ApiResponseProperty

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

                                                                                                                                        function ApiSchema

                                                                                                                                        ApiSchema: (options?: ApiSchemaOptions) => ClassDecorator;

                                                                                                                                          function ApiSecurity

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

                                                                                                                                            function ApiSeeOtherResponse

                                                                                                                                            ApiSeeOtherResponse: (
                                                                                                                                            options?: ApiResponseNoStatusOptions
                                                                                                                                            ) => MethodDecorator & ClassDecorator;

                                                                                                                                              function ApiServiceUnavailableResponse

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

                                                                                                                                                function ApiSwitchingProtocolsResponse

                                                                                                                                                ApiSwitchingProtocolsResponse: (
                                                                                                                                                options?: ApiResponseNoStatusOptions
                                                                                                                                                ) => MethodDecorator & ClassDecorator;

                                                                                                                                                  function ApiTags

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

                                                                                                                                                    function ApiTemporaryRedirectResponse

                                                                                                                                                    ApiTemporaryRedirectResponse: (
                                                                                                                                                    options?: ApiResponseNoStatusOptions
                                                                                                                                                    ) => MethodDecorator & ClassDecorator;

                                                                                                                                                      function ApiTooManyRequestsResponse

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

                                                                                                                                                        function ApiUnauthorizedResponse

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

                                                                                                                                                          function ApiUnprocessableEntityResponse

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

                                                                                                                                                            function ApiUnsupportedMediaTypeResponse

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

                                                                                                                                                              function ApiUriTooLongResponse

                                                                                                                                                              ApiUriTooLongResponse: (
                                                                                                                                                              options?: ApiResponseNoStatusOptions
                                                                                                                                                              ) => MethodDecorator & ClassDecorator;

                                                                                                                                                                function ApiWebhook

                                                                                                                                                                ApiWebhook: (name?: string) => MethodDecorator;

                                                                                                                                                                  function DeepPartialType

                                                                                                                                                                  DeepPartialType: <T>(
                                                                                                                                                                  classRef: Type<T>,
                                                                                                                                                                  options?: { skipNullProperties?: boolean }
                                                                                                                                                                  ) => Type<DeepPartial<T>>;

                                                                                                                                                                    function generateSchema

                                                                                                                                                                    generateSchema: <T = any>(
                                                                                                                                                                    target: Type<T>,
                                                                                                                                                                    extraSchemas?: Record<string, SchemaObject>
                                                                                                                                                                    ) => { schema: SchemaObject; schemas: Record<string, SchemaObject> };

                                                                                                                                                                      function getSchemaPath

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

                                                                                                                                                                        function IntersectionType

                                                                                                                                                                        IntersectionType: <T extends Type[]>(
                                                                                                                                                                        ...classRefs: T
                                                                                                                                                                        ) => Type<UnionToIntersection<ClassRefsToConstructors<T>[number]>>;

                                                                                                                                                                          function OmitType

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

                                                                                                                                                                            function PartialType

                                                                                                                                                                            PartialType: <T>(
                                                                                                                                                                            classRef: Type<T>,
                                                                                                                                                                            options?: { skipNullProperties?: boolean }
                                                                                                                                                                            ) => Type<Partial<T>>;

                                                                                                                                                                              function PickType

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

                                                                                                                                                                                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 addExtension

                                                                                                                                                                                            addExtension: (
                                                                                                                                                                                            extensionKey: string,
                                                                                                                                                                                            extensionProperties: any,
                                                                                                                                                                                            location?: ExtensionLocation
                                                                                                                                                                                            ) => this;

                                                                                                                                                                                              method addGlobalParameters

                                                                                                                                                                                              addGlobalParameters: (
                                                                                                                                                                                              ...parameters: Omit<ParameterObject, 'example' | 'examples'>[]
                                                                                                                                                                                              ) => this;

                                                                                                                                                                                                method addGlobalResponse

                                                                                                                                                                                                addGlobalResponse: (...respones: ApiResponseOptions[]) => 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>,
                                                                                                                                                                                                        serverExtraProperties?: Record<string, any>
                                                                                                                                                                                                        ) => this;

                                                                                                                                                                                                          method addTag

                                                                                                                                                                                                          addTag: (
                                                                                                                                                                                                          name: string,
                                                                                                                                                                                                          description?: string,
                                                                                                                                                                                                          externalDocs?: ExternalDocumentationObject,
                                                                                                                                                                                                          options?: { summary?: string; parent?: string; kind?: string }
                                                                                                                                                                                                          ) => 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 setOpenAPIVersion

                                                                                                                                                                                                                        setOpenAPIVersion: (version: 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: INestApplication,
                                                                                                                                                                                                                                  config: Omit<OpenAPIObject, 'paths'>,
                                                                                                                                                                                                                                  options?: SwaggerDocumentOptions
                                                                                                                                                                                                                                  ) => OpenAPIObject;

                                                                                                                                                                                                                                    method loadPluginMetadata

                                                                                                                                                                                                                                    static loadPluginMetadata: (
                                                                                                                                                                                                                                    metadataFn: () => Promise<Record<string, any>>
                                                                                                                                                                                                                                    ) => Promise<void>;

                                                                                                                                                                                                                                      method serveDefinitions

                                                                                                                                                                                                                                      protected static serveDefinitions: (
                                                                                                                                                                                                                                      httpAdapter: HttpServer,
                                                                                                                                                                                                                                      getBuiltDocument: () => OpenAPIObject,
                                                                                                                                                                                                                                      options: {
                                                                                                                                                                                                                                      jsonDocumentUrl: string;
                                                                                                                                                                                                                                      yamlDocumentUrl: string;
                                                                                                                                                                                                                                      swaggerOptions: SwaggerCustomOptions;
                                                                                                                                                                                                                                      },
                                                                                                                                                                                                                                      serveOptions: { serveJson: boolean; serveYaml: boolean }
                                                                                                                                                                                                                                      ) => void;

                                                                                                                                                                                                                                        method serveDocuments

                                                                                                                                                                                                                                        protected static serveDocuments: (
                                                                                                                                                                                                                                        finalPath: string,
                                                                                                                                                                                                                                        urlLastSubdirectory: string,
                                                                                                                                                                                                                                        httpAdapter: HttpServer,
                                                                                                                                                                                                                                        documentOrFactory: OpenAPIObject | (() => OpenAPIObject),
                                                                                                                                                                                                                                        options: {
                                                                                                                                                                                                                                        ui: boolean;
                                                                                                                                                                                                                                        raw: boolean | Array<'json' | 'yaml'>;
                                                                                                                                                                                                                                        jsonDocumentUrl: string;
                                                                                                                                                                                                                                        yamlDocumentUrl: string;
                                                                                                                                                                                                                                        swaggerOptions: SwaggerCustomOptions;
                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                        ) => void;

                                                                                                                                                                                                                                          method serveStatic

                                                                                                                                                                                                                                          protected static serveStatic: (
                                                                                                                                                                                                                                          finalPath: string,
                                                                                                                                                                                                                                          app: INestApplication,
                                                                                                                                                                                                                                          customStaticPath?: string
                                                                                                                                                                                                                                          ) => void;

                                                                                                                                                                                                                                            method serveSwaggerUi

                                                                                                                                                                                                                                            protected static serveSwaggerUi: (
                                                                                                                                                                                                                                            finalPath: string,
                                                                                                                                                                                                                                            urlLastSubdirectory: string,
                                                                                                                                                                                                                                            httpAdapter: HttpServer,
                                                                                                                                                                                                                                            getBuiltDocument: () => OpenAPIObject,
                                                                                                                                                                                                                                            swaggerOptions: SwaggerCustomOptions
                                                                                                                                                                                                                                            ) => void;

                                                                                                                                                                                                                                              method setup

                                                                                                                                                                                                                                              static setup: (
                                                                                                                                                                                                                                              path: string,
                                                                                                                                                                                                                                              app: INestApplication,
                                                                                                                                                                                                                                              documentOrFactory: OpenAPIObject | (() => OpenAPIObject),
                                                                                                                                                                                                                                              options?: SwaggerCustomOptions
                                                                                                                                                                                                                                              ) => void;

                                                                                                                                                                                                                                                Interfaces

                                                                                                                                                                                                                                                interface ApiHeaderOptions

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

                                                                                                                                                                                                                                                  property enum

                                                                                                                                                                                                                                                  enum?: SwaggerEnumType;

                                                                                                                                                                                                                                                    interface ApiLinkOptions

                                                                                                                                                                                                                                                    interface ApiLinkOptions {}

                                                                                                                                                                                                                                                      property from

                                                                                                                                                                                                                                                      from: Type<unknown> | Function;

                                                                                                                                                                                                                                                        property fromField

                                                                                                                                                                                                                                                        fromField?: string;

                                                                                                                                                                                                                                                          property routeParam

                                                                                                                                                                                                                                                          routeParam: string;

                                                                                                                                                                                                                                                            interface ApiResponseCommonMetadata

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

                                                                                                                                                                                                                                                              property description

                                                                                                                                                                                                                                                              description?: string;

                                                                                                                                                                                                                                                                property isArray

                                                                                                                                                                                                                                                                isArray?: boolean;

                                                                                                                                                                                                                                                                  property nullable

                                                                                                                                                                                                                                                                  nullable?: boolean;

                                                                                                                                                                                                                                                                    property status

                                                                                                                                                                                                                                                                    status?: number | 'default' | '1XX' | '2XX' | '3XX' | '4XX' | '5XX';

                                                                                                                                                                                                                                                                      property type

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

                                                                                                                                                                                                                                                                        interface ApiResponseExamples

                                                                                                                                                                                                                                                                        interface ApiResponseExamples {}

                                                                                                                                                                                                                                                                          property summary

                                                                                                                                                                                                                                                                          summary: string;

                                                                                                                                                                                                                                                                            property value

                                                                                                                                                                                                                                                                            value: ApiResponseExampleValue;

                                                                                                                                                                                                                                                                              interface ApiResponseSchemaHost

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

                                                                                                                                                                                                                                                                                property description

                                                                                                                                                                                                                                                                                description?: string;

                                                                                                                                                                                                                                                                                  property schema

                                                                                                                                                                                                                                                                                  schema: SchemaObject & Partial<ReferenceObject>;

                                                                                                                                                                                                                                                                                    property status

                                                                                                                                                                                                                                                                                    status?: number | 'default' | '1XX' | '2XX' | '3XX' | '4XX' | '5XX';

                                                                                                                                                                                                                                                                                      interface ApiSchemaOptions

                                                                                                                                                                                                                                                                                      interface ApiSchemaOptions extends Pick<SchemaObjectMetadata, 'name'> {}

                                                                                                                                                                                                                                                                                        property description

                                                                                                                                                                                                                                                                                        description?: string;

                                                                                                                                                                                                                                                                                          property name

                                                                                                                                                                                                                                                                                          name?: string;

                                                                                                                                                                                                                                                                                            interface ApiTagOptions

                                                                                                                                                                                                                                                                                            interface ApiTagOptions {}

                                                                                                                                                                                                                                                                                              property kind

                                                                                                                                                                                                                                                                                              kind?: string;

                                                                                                                                                                                                                                                                                                property name

                                                                                                                                                                                                                                                                                                name: string;

                                                                                                                                                                                                                                                                                                  property parent

                                                                                                                                                                                                                                                                                                  parent?: string;

                                                                                                                                                                                                                                                                                                    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[];

                                                                                                                                                                                                                                                                                                                      property webhooks

                                                                                                                                                                                                                                                                                                                      webhooks?: WebhooksObject;

                                                                                                                                                                                                                                                                                                                        interface SwaggerCustomOptions

                                                                                                                                                                                                                                                                                                                        interface SwaggerCustomOptions {}

                                                                                                                                                                                                                                                                                                                          property customCss

                                                                                                                                                                                                                                                                                                                          customCss?: string;

                                                                                                                                                                                                                                                                                                                            property customCssUrl

                                                                                                                                                                                                                                                                                                                            customCssUrl?: string | string[];

                                                                                                                                                                                                                                                                                                                              property customfavIcon

                                                                                                                                                                                                                                                                                                                              customfavIcon?: string;

                                                                                                                                                                                                                                                                                                                                property customJs

                                                                                                                                                                                                                                                                                                                                customJs?: string | string[];

                                                                                                                                                                                                                                                                                                                                  property customJsStr

                                                                                                                                                                                                                                                                                                                                  customJsStr?: string | string[];

                                                                                                                                                                                                                                                                                                                                    property customSiteTitle

                                                                                                                                                                                                                                                                                                                                    customSiteTitle?: string;

                                                                                                                                                                                                                                                                                                                                      property customSwaggerUiPath

                                                                                                                                                                                                                                                                                                                                      customSwaggerUiPath?: string;

                                                                                                                                                                                                                                                                                                                                        property explorer

                                                                                                                                                                                                                                                                                                                                        explorer?: boolean;

                                                                                                                                                                                                                                                                                                                                          property jsonDocumentUrl

                                                                                                                                                                                                                                                                                                                                          jsonDocumentUrl?: string;

                                                                                                                                                                                                                                                                                                                                            property patchDocumentOnRequest

                                                                                                                                                                                                                                                                                                                                            patchDocumentOnRequest?: <TRequest = any, TResponse = any>(
                                                                                                                                                                                                                                                                                                                                            req: TRequest,
                                                                                                                                                                                                                                                                                                                                            res: TResponse,
                                                                                                                                                                                                                                                                                                                                            document: OpenAPIObject
                                                                                                                                                                                                                                                                                                                                            ) => OpenAPIObject | Promise<OpenAPIObject>;

                                                                                                                                                                                                                                                                                                                                              property raw

                                                                                                                                                                                                                                                                                                                                              raw?: boolean | Array<'json' | 'yaml'>;

                                                                                                                                                                                                                                                                                                                                                property swaggerOptions

                                                                                                                                                                                                                                                                                                                                                swaggerOptions?: SwaggerUiOptions;

                                                                                                                                                                                                                                                                                                                                                  property swaggerUiEnabled

                                                                                                                                                                                                                                                                                                                                                  swaggerUiEnabled?: boolean;

                                                                                                                                                                                                                                                                                                                                                    property swaggerUrl

                                                                                                                                                                                                                                                                                                                                                    swaggerUrl?: string;

                                                                                                                                                                                                                                                                                                                                                      property ui

                                                                                                                                                                                                                                                                                                                                                      ui?: boolean;

                                                                                                                                                                                                                                                                                                                                                        property url

                                                                                                                                                                                                                                                                                                                                                        url?: string;

                                                                                                                                                                                                                                                                                                                                                          property urls

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

                                                                                                                                                                                                                                                                                                                                                            property useGlobalPrefix

                                                                                                                                                                                                                                                                                                                                                            useGlobalPrefix?: boolean;

                                                                                                                                                                                                                                                                                                                                                              property validatorUrl

                                                                                                                                                                                                                                                                                                                                                              validatorUrl?: string;

                                                                                                                                                                                                                                                                                                                                                                property yamlDocumentUrl

                                                                                                                                                                                                                                                                                                                                                                yamlDocumentUrl?: string;

                                                                                                                                                                                                                                                                                                                                                                  interface SwaggerDocumentOptions

                                                                                                                                                                                                                                                                                                                                                                  interface SwaggerDocumentOptions {}

                                                                                                                                                                                                                                                                                                                                                                    property autoTagControllers

                                                                                                                                                                                                                                                                                                                                                                    autoTagControllers?: boolean;

                                                                                                                                                                                                                                                                                                                                                                      property deepScanRoutes

                                                                                                                                                                                                                                                                                                                                                                      deepScanRoutes?: boolean;

                                                                                                                                                                                                                                                                                                                                                                        property exampleMaxDepth

                                                                                                                                                                                                                                                                                                                                                                        exampleMaxDepth?: number;

                                                                                                                                                                                                                                                                                                                                                                          property excludeDynamicDefaults

                                                                                                                                                                                                                                                                                                                                                                          excludeDynamicDefaults?: boolean;

                                                                                                                                                                                                                                                                                                                                                                            property extraModels

                                                                                                                                                                                                                                                                                                                                                                            extraModels?: Function[];

                                                                                                                                                                                                                                                                                                                                                                              property ignoreGlobalPrefix

                                                                                                                                                                                                                                                                                                                                                                              ignoreGlobalPrefix?: boolean;

                                                                                                                                                                                                                                                                                                                                                                                property include

                                                                                                                                                                                                                                                                                                                                                                                include?: Function[];

                                                                                                                                                                                                                                                                                                                                                                                  property linkNameFactory

                                                                                                                                                                                                                                                                                                                                                                                  linkNameFactory?: (
                                                                                                                                                                                                                                                                                                                                                                                  controllerKey: string,
                                                                                                                                                                                                                                                                                                                                                                                  methodKey: string,
                                                                                                                                                                                                                                                                                                                                                                                  fieldKey: string
                                                                                                                                                                                                                                                                                                                                                                                  ) => string;

                                                                                                                                                                                                                                                                                                                                                                                    property onlyIncludeDecoratedEndpoints

                                                                                                                                                                                                                                                                                                                                                                                    onlyIncludeDecoratedEndpoints?: boolean;

                                                                                                                                                                                                                                                                                                                                                                                      property operationIdFactory

                                                                                                                                                                                                                                                                                                                                                                                      operationIdFactory?: OperationIdFactory;

                                                                                                                                                                                                                                                                                                                                                                                        Type Aliases

                                                                                                                                                                                                                                                                                                                                                                                        type ApiBodyOptions

                                                                                                                                                                                                                                                                                                                                                                                        type ApiBodyOptions = ApiBodyMetadata | ApiBodySchemaHost;

                                                                                                                                                                                                                                                                                                                                                                                          type ApiOperationOptions

                                                                                                                                                                                                                                                                                                                                                                                          type ApiOperationOptions = Partial<OperationObject>;

                                                                                                                                                                                                                                                                                                                                                                                            type ApiParamOptions

                                                                                                                                                                                                                                                                                                                                                                                            type ApiParamOptions = ApiParamMetadata | ApiParamSchemaHost;

                                                                                                                                                                                                                                                                                                                                                                                              type ApiPropertyOptions

                                                                                                                                                                                                                                                                                                                                                                                              type ApiPropertyOptions =
                                                                                                                                                                                                                                                                                                                                                                                              | ApiPropertyCommonOptions
                                                                                                                                                                                                                                                                                                                                                                                              | (ApiPropertyCommonOptions & {
                                                                                                                                                                                                                                                                                                                                                                                              enumName: string;
                                                                                                                                                                                                                                                                                                                                                                                              enumSchema?: EnumSchemaAttributes;
                                                                                                                                                                                                                                                                                                                                                                                              });

                                                                                                                                                                                                                                                                                                                                                                                                type ApiQueryMetadata

                                                                                                                                                                                                                                                                                                                                                                                                type ApiQueryMetadata =
                                                                                                                                                                                                                                                                                                                                                                                                | ApiQueryCommonMetadata
                                                                                                                                                                                                                                                                                                                                                                                                | ({
                                                                                                                                                                                                                                                                                                                                                                                                name: string;
                                                                                                                                                                                                                                                                                                                                                                                                } & ApiQueryCommonMetadata &
                                                                                                                                                                                                                                                                                                                                                                                                Omit<SchemaObject, 'required'>)
                                                                                                                                                                                                                                                                                                                                                                                                | ({
                                                                                                                                                                                                                                                                                                                                                                                                name?: string;
                                                                                                                                                                                                                                                                                                                                                                                                enumName: string;
                                                                                                                                                                                                                                                                                                                                                                                                enumSchema?: EnumSchemaAttributes;
                                                                                                                                                                                                                                                                                                                                                                                                } & ApiQueryCommonMetadata);

                                                                                                                                                                                                                                                                                                                                                                                                  type ApiQueryOptions

                                                                                                                                                                                                                                                                                                                                                                                                  type ApiQueryOptions = ApiQueryMetadata | ApiQuerySchemaHost;

                                                                                                                                                                                                                                                                                                                                                                                                    type ApiResponseMetadata

                                                                                                                                                                                                                                                                                                                                                                                                    type ApiResponseMetadata =
                                                                                                                                                                                                                                                                                                                                                                                                    | (ApiResponseCommonMetadata & {
                                                                                                                                                                                                                                                                                                                                                                                                    example?: ApiResponseExampleValue;
                                                                                                                                                                                                                                                                                                                                                                                                    })
                                                                                                                                                                                                                                                                                                                                                                                                    | (ApiResponseCommonMetadata & {
                                                                                                                                                                                                                                                                                                                                                                                                    examples?: {
                                                                                                                                                                                                                                                                                                                                                                                                    [key: string]: ApiResponseExamples;
                                                                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                                                                    });

                                                                                                                                                                                                                                                                                                                                                                                                      type ApiResponseNoStatusOptions

                                                                                                                                                                                                                                                                                                                                                                                                      type ApiResponseNoStatusOptions =
                                                                                                                                                                                                                                                                                                                                                                                                      | (Omit<ApiResponseCommonMetadata, 'status'> & {
                                                                                                                                                                                                                                                                                                                                                                                                      example?: ApiResponseExampleValue;
                                                                                                                                                                                                                                                                                                                                                                                                      })
                                                                                                                                                                                                                                                                                                                                                                                                      | (Omit<ApiResponseCommonMetadata, 'status'> & {
                                                                                                                                                                                                                                                                                                                                                                                                      examples?: {
                                                                                                                                                                                                                                                                                                                                                                                                      [key: string]: ApiResponseExamples;
                                                                                                                                                                                                                                                                                                                                                                                                      };
                                                                                                                                                                                                                                                                                                                                                                                                      })
                                                                                                                                                                                                                                                                                                                                                                                                      | Omit<ApiResponseSchemaHost, 'status'>;

                                                                                                                                                                                                                                                                                                                                                                                                        type ApiResponseOptions

                                                                                                                                                                                                                                                                                                                                                                                                        type ApiResponseOptions = ApiResponseMetadata | ApiResponseSchemaHost;

                                                                                                                                                                                                                                                                                                                                                                                                          type DeepPartial

                                                                                                                                                                                                                                                                                                                                                                                                          type DeepPartial<T> = T extends object
                                                                                                                                                                                                                                                                                                                                                                                                          ? {
                                                                                                                                                                                                                                                                                                                                                                                                          [P in keyof T]?: DeepPartial<T[P]>;
                                                                                                                                                                                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                                                                                                                                                                                          : T;

                                                                                                                                                                                                                                                                                                                                                                                                            type OperationIdFactory

                                                                                                                                                                                                                                                                                                                                                                                                            type OperationIdFactory = (
                                                                                                                                                                                                                                                                                                                                                                                                            controllerKey: string,
                                                                                                                                                                                                                                                                                                                                                                                                            methodKey: string,
                                                                                                                                                                                                                                                                                                                                                                                                            version?: string
                                                                                                                                                                                                                                                                                                                                                                                                            ) => string;

                                                                                                                                                                                                                                                                                                                                                                                                              Package Files (40)

                                                                                                                                                                                                                                                                                                                                                                                                              Dependencies (6)

                                                                                                                                                                                                                                                                                                                                                                                                              Dev Dependencies (30)

                                                                                                                                                                                                                                                                                                                                                                                                              Peer Dependencies (6)

                                                                                                                                                                                                                                                                                                                                                                                                              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>