Skip to content

Update dependency @nestjs/swagger to v12 - #150

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/nestjs-swagger-12.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/nestjs-swagger-12.x

Conversation

@renovate

@renovate renovate Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
@nestjs/swagger ^7.0.1 → ^12.0.0 age confidence

Release Notes

nestjs/swagger (@​nestjs/swagger)

v12.0.2

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@12.0.1...12.0.2

v12.0.1

Compare Source

12.0.1 (2026-08-28)
Bug fixes
Dependencies
Committers: 1

v12.0.0

Compare Source

What's Changed

@nestjs/swagger is now a native ES module, requires Nest 12, and changes how nullable schemas are spelled in the generated document.

ESM migration

The package is published as pure ESM ("type": "module", compiled with NodeNext) behind a proper exports map. The legacy root index.ts / plugin.js / plugin.ts shims are gone, and deep imports into build internals are no longer resolvable — import from the package root (@nestjs/swagger) or from @nestjs/swagger/plugin.

require(esm) — CommonJS still works

You do not need to convert your app to ESM. Thanks to Node's require(esm) support, a CommonJS app can keep doing const { SwaggerModule } = require('@nestjs/swagger'). The CLI plugin entry (@nestjs/swagger/plugin) also keeps a require condition so nest-cli.json setups load it unchanged.

This is why the package now declares "engines": { "node": "^20.19.0 || >=22.12.0" } — those are the Node versions where require(esm) is available without a flag.

Nest 12 peer dependencies

@nestjs/common and @nestjs/core peers are now ^12.0.0. @nestjs/mapped-types moves to 12.0.0 (itself ESM, with its major aligned to the Nest 12 line), so PartialType, PickType, OmitType and IntersectionType come from an ESM build too.

Standard Schema support

Schemas passed to Nest 12's route decorators (for example @Body({ schema: z.object({ ... }) })) can now be reflected into the OpenAPI document. Supply an adapter via the new standardSchemaConverter document option:

import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import type { SwaggerDocumentOptions } from '@nestjs/swagger';
import { createSchema } from 'zod-openapi';
import type { ZodType } from 'zod';

// Standard Schema exposes the producing library under `~standard.vendor`,
// which is how you narrow the raw value to a library-specific type.
function isZodSchema(schema: unknown): schema is ZodType {
  return (
    !!schema &&
    typeof schema === 'object' &&
    (schema as { '~standard'?: { vendor?: string } })['~standard']?.vendor ===
      'zod'
  );
}

const options: SwaggerDocumentOptions = {
  standardSchemaConverter: (schema, { schemaType }) => {
    if (isZodSchema(schema)) {
      const { schema: converted, components } = createSchema(schema, {
        io: schemaType,
        openapiVersion: '3.0.0'
      });
      return { schema: converted, components };
    }
  }
};

SwaggerModule.createDocument(app, config, options);

SwaggerDocumentOptions, StandardSchemaConverter and StandardSchemaConversionResult are all exported from @nestjs/swagger; createSchema comes from [zod-openapi](https://www.npmjs.com/package/zod-openapi) (for Valibot, use toJsonSchema from @valibot/to-json-schema with target: 'openapi-3.0' and check for the 'valibot' vendor instead). Neither is a dependency of this package — install whichever converter matches the schema library you use.

The callback receives the raw schema value plus whether an input or output schema is wanted, so you can narrow to library-specific types without unsafe casts, and return extra components to register. Returning undefined falls back to the DTO-derived schema, so one converter can handle several libraries and ignore the rest. Standard Schema overrides apply to bodies, queries, params, unions and enums, and take priority over the DTO-derived schema.

Breaking: nullability is spelled per document version

Nullable schemas are now normalized once on the finished document, matching the version it declares:

  • 3.1.0 and later — the nullable keyword (removed in JSON Schema 2020-12) is gone. Typed schemas become a type union (type: ['string', 'null']), enums gain a null value, and references and composite schemas become anyOf: [<schema>, { type: 'null' }]. The 3.0 type: 'object' + allOf wrapper around nullable references is unwrapped. Previously these documents carried nullable, which strict 3.1 consumers silently ignore — reading the property as non-nullable.
  • 3.0.x — nullable responses go back to the nullable keyword (with the allOf wrapper for references). Since #​3897 they emitted oneOf: [<schema>, { type: 'null' }], a type: 'null' that 3.0 does not define.

The pass covers schema properties, parameters, headers, request bodies, responses, callbacks and webhooks, plus any nullable you wrote by hand. Free-form positions (example, examples, default, const, enum) and x- extensions are left alone. Snapshot tests asserting nullable: true in 3.1 documents, or oneOf in 3.0 responses, will need updating.

Closes #​4063.

Breaking: lodash replaced with es-toolkit

lodash is no longer a runtime dependency — internals use es-toolkit/compat. This shrinks the install footprint and only affects you if you relied on lodash arriving transitively.

CLI plugin

  • esmCompatible is now auto-detected per file. The plugin resolves each source file's implied module format (via package.json type and the module setting) and emits ESM-compatible output for ESM projects. Setting esmCompatible explicitly in nest-cli.json still wins — the resolved value is only used when you left it unset. Fixes generated imports in ESM projects that previously got CJS-shaped output.
  • JSDoc @param tags now become descriptions. With introspectComments on, a @param tag is matched to the route parameter by name and sets the description on the generated @ApiQuery / @ApiParam. Existing explicit @ApiQuery / @ApiParam decorators are left untouched. Closes #​2784.
  • A require export condition was added for the plugin entry so CJS-based CLI setups keep working. Fixes #​3944.

Upgrading

For most apps the upgrade is: bump @nestjs/swagger to ^12.0.0 alongside Nest 12, make sure you are on Node 20.19+ / 22.12+, and re-check any committed OpenAPI snapshot for the nullable spelling above.

v11.4.7

Compare Source

v11.4.6

Compare Source

11.4.6 (2026-07-17)

Features
Bug fixes
Enhancements
Dependencies
Committers: 4

v11.4.5

Compare Source

What's Changed

Full Changelog: nestjs/swagger@11.4.4...11.4.5

v11.4.4

Compare Source

11.4.4 (2026-05-21)

Bug fixes
Enhancements
Committers: 4

v11.4.3

Compare Source

11.4.3 (2026-05-14)

Bug fixes
Enhancements
Dependencies
Committers: 6

v11.4.2

Compare Source

11.4.2 (2026-04-27)

Bug fixes
  • #​3867 fix(plugin): keep auto-inferred default response when only error Api*Response decorators are present (@​PeterTheOne)
  • #​3876 fix(plugin): handle IsIn enum inference when type falls back to Object (@​y-hsgw)
Committers: 2

v11.4.1

Compare Source

11.4.1 (2026-04-22)

Bug fixes
Committers: 1

v11.4.0

Compare Source

11.4.0 (2026-04-22)

Features
Bug fixes
Enhancements
Committers: 4

v11.3.2

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.3.1...11.3.2

v11.3.1

Compare Source

11.3.1 (2026-04-20)

Bug fixes
Enhancements
  • #​3854 fix(swagger-ui): replace hardcoded sentinel with per-call UUID in buildJSInitOptions (@​kyuna0312)
Committers: 5

v11.3.0

Compare Source

11.3.0 (2026-04-15)

Bug fixes
Enhancements
Dependencies
Committers: 7

v11.2.7

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.2.6...11.2.7

v11.2.6

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.2.5...11.2.6

v11.2.5

Compare Source

11.2.5 (2026-01-14)

Bug fixes
Enhancements
Committers: 2

v11.2.4

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.2.3...11.2.4

v11.2.3

Compare Source

What's Changed

Full Changelog: nestjs/swagger@11.2.2...11.2.3

v11.2.2

Compare Source

11.2.2 (2025-11-16)

Bug fixes
Dependencies
Committers: 1

v11.2.1

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.2.0...11.2.1

v11.2.0

Compare Source

11.2.0 (2025-05-05)

Enhancements
Committers: 2

v11.1.6

Compare Source

11.1.6 (2025-04-30)

Enhancements
  • #​3423 feat(swagger-plugin): add skipDefaultValues option to omit unspecified default fields and corresponding test (@​mag123c)
Committers: 1

v11.1.5

Compare Source

11.1.5 (2025-04-22)

Bug fixes
Committers: 1

v11.1.4

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.1.3...11.1.4

v11.1.3

Compare Source

11.1.3 (2025-04-14)

Bug fixes
Dependencies
Committers: 1

v11.1.2

Compare Source

11.1.2 (2025-04-11)

Bug fixes
Enhancements
Dependencies
Committers: 2

v11.1.1

Compare Source

11.1.1 (2025-04-04)

Bug fixes
Dependencies
Committers: 1

v11.1.0

Compare Source

11.1.0 (2025-03-25)

Features
Committers: 1

v11.0.7

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.0.6...11.0.7

v11.0.6

Compare Source

11.0.6 (2025-02-28)

Bug fixes
  • #​3324 feat: support native private class properties in model class visitor (@​rklos))
Committers: 1

v11.0.5

Compare Source

11.0.5 (2025-02-24)

What's Changed

Full Changelog: nestjs/swagger@11.0.4...11.0.5

v11.0.4

Compare Source

What's Changed

New Contributors

Full Changelog: nestjs/swagger@11.0.3...11.0.4

v11.0.3

Compare Source

11.0.3 (2025-01-23)

Bug fixes
Committers: 1

v11.0.2

Compare Source

Changelog
  • Revert "feat: make generated require() ESM compatible #​3253

v11.0.1

Compare Source

11.0.1 (2025-01-17)

Dependencies

v11.0.0

Compare Source

11.0.0 (2025-01-16)

Breaking changes

This version is only compatible with @nestjs/{core,common,platform-express,platform-fastify,...} >= v11

Enhancements
Dependencies
Committers: 2

v8.1.1

Compare Source

Unreleased (2025-01-10)

Bug fixes
  • #​3232 fix: missing ApiProperty enum undefined handling (@​nxht)
  • #​3223 fix: swagger crashed while using any Param/Query/Body decorator in a monorepo with pnpm (@​winuxx)
Dependencies
Committers: 3

v8.1.0

Compare Source

8.1.0 (2024-12-04)

Enhancements
Committers: 2

v8.0.7

Compare Source

8.0.7 (2024-11-15)

Bug fixes
Committers: 1

v8.0.6

Compare Source

8.0.6 (2024-11-15)

Bug fixes
Dependencies
Committers: 2

v8.0.5

Compare Source

8.0.5 (2024-11-08)

Dependencies

v8.0.4

Compare Source

8.0.4 (2024-11-08)

Bug fixes
Dependencies
Committers: 1

v8.0.3

Compare Source

8.0.3 (2024-11-07)

Bug fixes
Enhancements
Dependencies
Committers: 1

v8.0.2

Compare Source

8.0.2 (2024-11-05)

Bug fixes

❗ Important

✂ PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate

renovate Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor Author

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: package-lock.json
npm warn Unknown env config "store". This will error in a future major version of npm. See `npm help npmrc` for supported config options.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: network-scanner@0.0.1
npm error Found: @nestjs/common@10.4.22
npm error node_modules/@nestjs/common
npm error   @nestjs/common@"^10.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @nestjs/common@"^12.0.0" from @nestjs/swagger@12.0.2
npm error node_modules/@nestjs/swagger
npm error   @nestjs/swagger@"^12.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /runner/cache/others/npm/_logs/2026-10-01T03_28_04_737Z-eresolve-report.txt
npm error A complete log of this run can be found in: /runner/cache/others/npm/_logs/2026-10-01T03_28_04_737Z-debug-0.log

@renovate
renovate Bot force-pushed the renovate/nestjs-swagger-12.x branch 3 times, most recently from b53f926 to 23e703d Compare September 1, 2026 18:29
@renovate
renovate Bot force-pushed the renovate/nestjs-swagger-12.x branch 2 times, most recently from 5016358 to 0c5fcec Compare September 10, 2026 03:43
@renovate
renovate Bot force-pushed the renovate/nestjs-swagger-12.x branch 7 times, most recently from 0b5dfcc to f92b401 Compare September 23, 2026 01:54
@renovate
renovate Bot force-pushed the renovate/nestjs-swagger-12.x branch 5 times, most recently from f277f54 to fda6799 Compare September 26, 2026 01:41
@renovate
renovate Bot force-pushed the renovate/nestjs-swagger-12.x branch from fda6799 to fc88048 Compare September 29, 2026 01:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants