github nestjs/swagger 12.1.0
Release 12.1.0

2 hours ago

Behavior changes

  • PartialType() / DeepPartialType(): documented properties without validators are now stripped or rejected by a whitelisting ValidationPipe.
  • swagger-ui-init.js ignores the url query parameter of the docs page. Use swaggerUrl or swaggerOptions.url / urls instead.
  • When the setup path ends in a route parameter (e.g. docs/:tenant), the /<last segment>/ aliases for the init script and static assets are no longer registered.
  • DocumentBuilder: addGlobalParameters() and addGlobalResponse() apply only to documents created from that builder's config, and build() returns a new copy on every call.
  • The demo page (index.html) and the LICENSE file of swagger-ui-dist are never served, and the static assets no longer serve directory index files.
  • @ApiHideProperty() hides a property inherited from a parent class, and a property decorated with both @ApiProperty() and @ApiHideProperty() is hidden.
  • @ApiIncludeEndpoint(false) counts as not decorated under onlyIncludeDecoratedEndpoints, and controllers without any documented endpoint no longer register their class-level models.
  • A default holding a model lists only the properties the model documents.
  • Inline OmitType() / PickType() schema names spell only documented keys, and mapped type names are resolved when they are read.
  • The CLI plugin metadata of a class that re-declares an inherited property takes precedence over what was inferred for the parent class. Options set with decorators still apply.
  • Routes sharing a path and method document the union of their security requirements.
  • OpenAPI < 3.1: a webhook sharing its path and method with a route is left out of the document (with a warning) instead of replacing the route.
  • Response links to operations that are not in the document are removed.

Fixes

  • fix(type-helpers): make only validated properties optional in partial types (3254eb6)
  • fix(swagger-module): skip asset aliases when the path ends in a param (ab1e33d)
  • fix(swagger-ui): ignore the url query parameter in swagger-ui-init.js (820cb61)
  • fix(type-helpers): match numeric keys in OmitType and PickType (74776cc)
  • fix(document-builder): scope global metadata and built configs to the builder (5245be9)
  • fix(schema): omit hidden model properties from property defaults (933d8e6)
  • fix(explorer): apply endpoint exclusion before exploring a controller (cc75875)
  • fix(explorer): stop sharing security metadata between targets and operations (a79603d)
  • fix(swagger-module): keep routes that share a path with a webhook (4934af4)
  • fix(decorators): let @ApiHideProperty() hide inherited properties (5beb329)
  • fix(plugin): honor aliased and parameter-level hide decorators (d77fdf2)
  • fix(explorer): apply plugin metadata to the methods its class declares (68c5b45)
  • fix(transformer): keep security requirements of routes sharing a path (1c45e42)
  • fix(services): document only the parameters an override declares (66635c9)
  • fix(swagger-module): drop links to operations missing from the document (d3edf0a)
  • fix(swagger-module): never serve the demo page and license of swagger-ui-dist (332865b)
  • fix(type-helpers): spell only documented keys in mapped type names (134d45e)
  • fix(services): prefer a re-declaration's plugin metadata over inferred metadata (3def7ca)
  • fix(deps): update dependency @nestjs/mapped-types to v12.0.1 (b2293a0)

What's Changed

  • fix(api-property): resolve function enums when the document is generated by @Chrisp1tv in #4198
  • fix(responses): move nullable into the schema of schema and standard schema responses by @kkatalz in #4201
  • perf: import es-toolkit helpers by subpath by @thekhegay in #4220
  • fix(plugin): keep the type of unions with both null and undefined by @kkatalz in #4224
  • fix(api-property): reset required when re-declaring an inherited property by @samuelmbabhazi in #4226
  • fix(plugin): read @example values written on the line after the tag by @kkatalz in #4227
  • fix(schema): read standard schemas that are functions by @MichaelDeBoey in #4230
  • fix(plugin): keep apostrophes in double-quoted @example values by @kkatalz in #4232

New Contributors

Full Changelog: 12.0.5...12.1.0

Don't miss a new swagger release

NewReleases is sending notifications on new releases.