unstale

npm / @nestjs/swagger

@nestjs/swagger

What changed in @nestjs/swagger 6 to 12, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.

26 breaking1 deprecations29 new APIs and options14 behavior and defaults1 tooling129 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@nestjs/swagger 12102 changes

Breaking changes 18

  • Controllers without a documented endpoint no longer register their class-level models.

    12.1.0release notes

  • Metadata for a class's re-declared inherited property takes precedence over inferred parent metadata; decorator options still apply.

    12.1.0release notes

  • With a whitelisting ValidationPipe, documented properties without validators are stripped or rejected.

    12.1.0release notes

  • With a whitelisting ValidationPipe, documented properties without validators are stripped or rejected.

    12.1.0release notes

  • When the setup path ends in a route parameter, the aliases for the init script and static assets are no longer registered.

    12.1.0release notes

  • Static assets no longer serve directory index files.

    12.1.0release notes

  • swagger-ui-init.js ignores the docs page's url query parameter; use swaggerUrl or swaggerOptions.url / urls instead.

    12.1.0release notes

  • Schema-only keywords are moved from parameters into the schema.

    12.0.3release notes

  • The CLI plugin now detects esmCompatible per source file from package.json type and the module setting when the option is unset; an explicit nest-cli.json value still wins.

    12.0.0release notes

  • lodash is no longer a runtime dependency; this affects projects that relied on it arriving transitively.

    12.0.0release notes

  • The peer dependency range is now ^12.0.0, so projects using @nestjs/swagger must align with Nest 12.

    12.0.0release notes

  • The package moves to 12.0.0 and its mapped-type helpers come from an ESM build aligned with the Nest 12 line.

    12.0.0release notes

  • Version 12 requires TypeScript 6 as a peer dependency, so projects using TypeScript 5 must update TypeScript when upgrading the schematics package.

    12.0.0upgrade guide

  • The package is published as pure ESM with an exports map; import from the package root or @nestjs/swagger/plugin, because deep imports into build internals are no longer resolvable.

    12.0.0release notes

  • The package requires Node ^20.19.0 or >=22.12.0, where require(esm) is available without a flag.

    12.0.0release notes

  • For OpenAPI 3.1.0 and later, nullable schemas are normalized without the nullable keyword: typed schemas use a type union, enums gain null, and references and composites use anyOf.

    12.0.0release notes

  • For OpenAPI 3.0.x, nullable responses use the nullable keyword again, with the allOf wrapper for references, instead of oneOf with a null schema.

    12.0.0release notes

  • Optional markers are no longer inherited when a subclass redeclares its constructor; in 12.0.x, a subclass without its own constructor also drops the markers. Missing dependencies can therefore throw UnknownDependenciesException instead of resolving to undefined.

    12.0.0upgrade guide

New APIs and options 4

  • Support is added for the HTTP QUERY method (RFC 10008).

    12.0.2release notes

  • With introspectComments enabled, JSDoc @param tags matched by route-parameter name set descriptions on generated @ApiQuery or @ApiParam decorators; existing explicit decorators are untouched.

    12.0.0release notes

  • Route parameter decorator schemas compatible with Standard Schema can also feed OpenAPI generation.

    12.0.0upgrade guide

  • This new document option converts Standard Schema values into OpenAPI schemas, can register extra components, and falls back to the DTO-derived schema when it returns undefined.

    12.0.0release notes

Behavior and default changes 7

  • Global parameters apply only to documents created from that builder's config.

    12.1.0release notes

  • Global responses apply only to documents created from that builder's config.

    12.1.0release notes

  • Each call returns a new copy.

    12.1.0release notes

  • The swagger-ui-dist license file is never served.

    12.1.0release notes

  • Mapped type names are resolved when they are read.

    12.1.0release notes

  • Routes sharing a path and method document the union of their security requirements.

    12.1.0release notes

  • Strips the example depth limit from parameters.

    12.0.5release notes

Fixes and other changes 73

  • Dynamic defaults are stripped from additional properties.

    12.1.2release notes

  • Inferred additional properties are dropped beside a combinator.

    12.1.2release notes

  • Re-declaring a property preserves its inherited type.

    12.1.2release notes

  • Numeric constraints on arrays are moved to their items.

    12.1.2release notes

  • Explicit items and type are preserved on array properties with combinators.

    12.1.2release notes

  • Callback request body schemas are registered.

    12.1.2release notes

  • Class-level params are documented on inherited routes.

    12.1.2release notes

  • An enum member is imported through its enum's specifier.

    12.1.2release notes

  • A trailing slash is stripped from the global prefix during setup.

    12.1.2release notes

  • Inferred success responses remain next to error decorators.

    12.1.2release notes

  • Transformers no longer stack when using IntersectionType.

    12.1.2release notes

  • Inferred types are kept out of mapped explicit options.

    12.1.2release notes

  • Plugin metadata is read before nested default keys are selected.

    12.1.2release notes

  • Required keys are preserved for nested object literal properties.

    12.1.2release notes

  • Object typed query properties are kept inline.

    12.1.2release notes

  • Comment metadata is merged into explicit operation decorators.

    12.1.2release notes

  • Metadata for classes missing from the loaded module is skipped.

    12.1.2release notes

  • Enum component types are inferred from query DTO properties.

    12.1.2release notes

  • Single enum member types emit an enum array.

    12.1.2release notes

  • Method shorthand options are serialized into valid JavaScript.

    12.1.2release notes

  • Falsy example values are preserved.

    12.1.1release notes

  • API links use the operation id set with @ApiOperation.

    12.1.1release notes

  • Explicit items specified for array parameters are preserved.

    12.1.1release notes

  • Length constraints for array parameters are moved to the items.

    12.1.1release notes

  • Arrays of bigint properties are documented as arrays.

    12.1.1release notes

  • Headers declared on both a controller and a method are merged.

    12.1.1release notes

  • Global response types and descriptions are normalized.

    12.1.1release notes

  • Example values remain strings for optional string properties.

    12.1.1release notes

  • Numeric exclusive bounds are emitted correctly in OpenAPI 3.1 documents.

    12.1.1release notes

  • OpenAPI 3.1 keywords for parameters are moved into the schema.

    12.1.1release notes

  • Dynamic defaults are stripped from operation schemas.

    12.1.1release notes

  • An explicitly declared type is preserved when a schema combinator is declared.

    12.1.1release notes

  • Array types written as a tuple are documented correctly.

    12.1.1release notes

  • Hides properties inherited from a parent class, and takes precedence when a property also has ApiProperty.

    12.1.0release notes

  • ApiIncludeEndpoint(false) counts as not decorated under onlyIncludeDecoratedEndpoints.

    12.1.0release notes

  • A default holding a model lists only the properties that model documents.

    12.1.0release notes

  • The plugin reads @example values written on the line after the tag and preserves apostrophes in double-quoted values.

    12.1.0release notes

  • Function enums are resolved when the document is generated.

    12.1.0release notes

  • The swagger-ui-dist demo page is never served.

    12.1.0release notes

  • Nullable is moved into the schema of schema and standard schema responses.

    12.1.0release notes

  • OmitType and PickType now match numeric keys.

    12.1.0release notes

  • Inline schema names spell only documented keys, and numeric keys are matched.

    12.1.0release notes

  • Inline schema names spell only documented keys, and numeric keys are matched.

    12.1.0release notes

  • Re-declaring an inherited property resets its required status.

    12.1.0release notes

  • Links to operations absent from the document are removed.

    12.1.0release notes

  • Function-valued standard schemas are read.

    12.1.0release notes

  • The plugin preserves the type of unions containing both null and undefined.

    12.1.0release notes

  • For OpenAPI versions below 3.1, a webhook sharing a route's path and method is left out with a warning instead of replacing the route.

    12.1.0release notes

  • Keeps every @ApiOperation argument when adding comments, preventing operation metadata from being lost.

    12.0.5release notes

  • Preserves explicit global imports during deep scans.

    12.0.5release notes

  • Preserves the summary and every @throws entry in readonly metadata.

    12.0.5release notes

  • Fixes resolution of UI assets for index.html and requests with query strings.

    12.0.4release notes

  • Method-level consumes and produces settings no longer leak across methods.

    12.0.3release notes

  • A custom Swagger UI path is served correctly under nested routes.

    12.0.3release notes

  • Date and bigint response and body types map to scalar schemas.

    12.0.3release notes

  • DeepPartialType is cached separately for each skipNullProperties setting.

    12.0.3release notes

  • Nested DeepPartial types receive distinct schema names.

    12.0.3release notes

  • Default responses are converted in OpenAPI 3.1 documents.

    12.0.3release notes

  • The plugin gives a node_modules subpath its extension under ESM.

    12.0.3release notes

  • Non-standard HTTP methods are kept off path item fields.

    12.0.3release notes

  • Constraints from parameters and schemas are merged into allOf.

    12.0.3release notes

  • Parameter schema options such as example are kept when a schema is set.

    12.0.3release notes

  • Parameter allOf, $ref siblings, enum, and required are handled consistently.

    12.0.3release notes

  • The plugin strips the resolution-mode attribute in CommonJS output.

    12.0.3release notes

  • The plugin preserves false defaults in synthetic identifiers.

    12.0.3release notes

  • Standard schema query parameters are merged with @ApiQuery.

    12.0.2release notes

  • The package is resolved through a bundler-visible dynamic import.

    12.0.2release notes

  • A standard-schema description is promoted to the parameter object.

    12.0.2release notes

  • The plugin treats single literal types as enums.

    12.0.2release notes

  • The generated file preserves $ characters when it is built.

    12.0.2release notes

  • TypeScript is declared as an optional peer dependency.

    12.0.2release notes

  • The plugin keeps the source package specifier for workspace imports.

    12.0.2release notes

  • Fixes hoisting of static imports in ESM.

    12.0.1release notes

@nestjs/swagger 1178 changes

Breaking changes 2

  • The pet store definition is no longer served on api/api.

    11.2.1release notes

  • This version is only compatible with @nestjs/core, @nestjs/common, @nestjs/platform-express, @nestjs/platform-fastify, and related packages at v11 or higher.

    11.0.0release notes

Deprecations 1

  • Warns when @ApiTags receives hierarchy fields.

    11.4.4release notes

New APIs and options 17

  • Support custom OpenAPI extensions in API header definitions.

    11.4.7release notes

  • Generate object examples from @example doc tags.

    11.4.7release notes

  • Export full OpenAPI object-model types in the public API.

    11.4.7release notes

  • @ApiQuery supports custom OpenAPI extensions.

    11.4.6release notes

  • Adds a summary field to the OpenAPI Tag Object for OpenAPI 3.2.

    11.4.4release notes

  • Adds ApiIncludeEndpoint.

    11.4.3release notes

  • The plugin auto-generates enum metadata for string and number literal union types.

    11.4.3release notes

  • The plugin supports boolean literal types and boolean enum values.

    11.4.0release notes

  • Adds support for OpenAPI 3.2 hierarchical tags.

    11.4.0release notes

  • The ApiBody decorator supports encoding.

    11.3.0release notes

  • The ApiHeader decorator accepts an example property.

    11.3.0release notes

  • The plugin option suppresses duplicate enum schemas.

    11.3.0release notes

  • A mapped-type helper provides recursive optional properties.

    11.3.0release notes

  • This option strips runtime-evaluated schema defaults.

    11.3.0release notes

  • The generateSchema utility is exposed for programmatic schema access.

    11.3.0release notes

  • Supports adding custom fields to entries in servers[*].

    11.2.6release notes

  • The schema object metadata interface now accepts the file type.

    11.2.4release notes

Behavior and default changes 5

  • The plugin infers the ApiParam enum from literal-union types used with @Param.

    11.4.6release notes

  • The pattern option accepts RegExp instances.

    11.3.0release notes

  • Descriptions are merged when multiple decorators share the same HTTP status code.

    11.3.0release notes

  • The patchDocumentOnRequest hook supports asynchronous implementations.

    11.3.0release notes

  • Generated require() is ESM compatible.

    11.0.0release notes

Tooling 1

  • Adds a type definition for the format option in the @ApiProperty decorator.

    11.2.6release notes

Fixes and other changes 52

  • Preserve inferred responses for enum error statuses.

    11.4.7release notes

  • Apply deep partial substitution to plugin metadata.

    11.4.7release notes

  • The plugin handles decorators with property access expressions when resolving identifiers.

    11.4.7release notes

  • Rebase readonly import paths onto the output directory.

    11.4.7release notes

  • Nested DTO arrays retain their array-ness when using DeepPartialType.

    11.4.6release notes

  • Objects are cloned per mimetype to avoid shared references.

    11.4.6release notes

  • Inline PickType schemas no longer collide.

    11.4.6release notes

  • The response object now includes the missing summary type.

    11.4.6release notes

  • The plugin now generates additionalProperties for Record and index-signature types.

    11.4.5release notes

  • Types the Tag Object kind as a free-form string.

    11.4.4release notes

  • Fixes an issue involving top-level nullable schemas with a discriminator.

    11.4.4release notes

  • Replies from async route handlers are now returned.

    11.4.3release notes

  • Const enum query parameters are now supported.

    11.4.3release notes

  • Preserves example and examples for built-in scalar response types.

    11.4.3release notes

  • Places multipleOf inside the parameter schema.

    11.4.3release notes

  • Keeps the auto-inferred default response when only error Api*Response decorators are present.

    11.4.2release notes

  • Handles IsIn enum inference when the type falls back to Object.

    11.4.2release notes

  • Fixes duplicate keys when @ApiOperation is auto-generated.

    11.4.1release notes

  • @ApiHeader now forwards all OpenAPI parameter fields.

    11.4.0release notes

  • Circular dependency errors include the class name chain to help identify the dependency path.

    11.4.0release notes

  • Example metadata is preserved for non-body parameters with named types.

    11.4.0release notes

  • The plugin strips regex delimiters and flags from @Matches patterns.

    11.4.0release notes

  • The document builder accepts OpenAPI version strings with multi-digit segments.

    11.4.0release notes

  • The plugin automatically marks optional @Query parameters as required: false.

    11.4.0release notes

  • The plugin emits @throws descriptions as proper string literals.

    11.4.0release notes

  • The plugin remaps import paths within rootDir to outDir.

    11.3.2release notes

  • Supports enumName with oneOf and anyOf combinators.

    11.3.1release notes

  • Prioritizes oneOf, anyOf, and allOf over inferred type resolution when generating schemas.

    11.3.1release notes

  • Adjusts plugin relative import paths for tsconfig outDir depth, fixing generated imports when output directories are nested.

    11.3.1release notes

  • When an inherited property is redeclared, the child class type is used.

    11.3.0release notes

  • Nullable fields are now supported in the ApiResponse decorator.

    11.3.0release notes

  • An enum issue is fixed.

    11.3.0release notes

  • Plugin metadata properties are eagerly applied in mapped type helpers.

    11.3.0release notes

  • Workspace package import paths are normalized in the metadata generator.

    11.3.0release notes

  • Schemas include a type field when nullable is used with allOf.

    11.3.0release notes

  • Same-file type references are handled in SWC readonly metadata generation.

    11.3.0release notes

  • The plugin skips the auto-generated response decorator when an Api*Response decorator is already present.

    11.2.7release notes

  • Schema generation handles const enum objects from SWC compiler metadata.

    11.2.7release notes

  • The decorators no longer crash on a Controller getter.

    11.2.7release notes

  • Enum schemas are no longer mutated across multiple document generations.

    11.2.7release notes

  • operationIdFactory receives the version for all versioning types.

    11.2.7release notes

  • The plugin handles non-ASCII characters in project paths.

    11.2.7release notes

  • The plugin supports TypeScript project references in ReadonlyVisitor.

    11.2.7release notes

  • Adds string literal types to ApiQueryOptions for autocomplete.

    11.2.6release notes

  • The plugin's debug option is respected for all debug log messages.

    11.2.5release notes

  • Static asset loading is resolved when the path has a trailing slash.

    11.2.5release notes

  • Preserves the items schema when metadata.items is already defined.

    11.2.4release notes

  • The plugin no longer adds an async modifier when a reference is an await import statement.

    11.2.3release notes

  • The plugin adds the async modifier when a reference is an await import statement.

    11.2.2release notes

  • When used on a controller, @ApiExtension applies to all methods.

    11.2.1release notes

  • Fixes missing ApiProperty enum undefined handling for arrays.

    11.2.1release notes

  • Corrects plugin handling of enum values combined with nullable types such as Enum | null.

    11.2.1release notes

@nestjs/swagger 816 changes

Breaking changes 5

  • API tags now default to the controller name.

    8.0.0release notes

  • Specific ApiResponse decorator option types now omit status.

    8.0.0release notes

  • Moves modifier properties to the items object on array types.

    8.0.0release notes

  • The transformer now prefers explicit configuration over an auto-detected schema.

    8.0.0release notes

  • Swagger module methods are now protected.

    8.0.0release notes

New APIs and options 7

  • Adds a decorator for defining API callbacks.

    8.0.0release notes

  • Supports multiple response body examples in the ApiResponse annotation.

    8.0.0release notes

  • Adds a decorator for specifying the schema type name.

    8.0.0release notes

  • Adds a merge-options condition for dtoFileNameSuffix to the CLI plugin.

    8.0.0release notes

  • Introduces an enum schema attribute.

    8.0.0release notes

  • Adds support for OpenAPI link objects.

    8.0.0release notes

  • Adds a document-builder method for setting the OpenAPI version.

    8.0.0release notes

Behavior and default changes 1

  • Extends support for validation property assignments.

    8.0.0release notes

Fixes and other changes 3

  • Fixes plugin metadata so enum arrays are marked as arrays.

    8.0.0release notes

  • Fixes importing external enums.

    8.0.0release notes

  • Fixes handling of arrays and objects located at the first level of @Query().

    8.0.0release notes

@nestjs/swagger 73 changes

Breaking changes 1

  • Support for TypeScript versions below 4.8 is dropped, so projects must use TypeScript 4.8 or newer.

    7.0.0release notes

New APIs and options 1

Fixes and other changes 1

@nestjs/swagger 61 changes

Behavior and default changes 1

  • Swagger routing is no longer tied to a specific platform, allowing it to work across platform adapters.

    6.0.0release notes