docs(controllerClass, config)

Applies Swagger decorators to a controller class from outside its file. Call it at the top level of *.controller.docs.ts: the call runs as a side effect on import.

Signature

Fully type-safe: config.methods only accepts keys that exist on the controller class.

ts
docs(UsersController, {
  classDecorators: [ApiTags('users')],
  methods: {
    findAll: [...],    // ✔ exists on UsersController
    typoMethod: [...], // ✖ TypeScript error
  },
});

config

  • classDecorators (ClassDecorator[]): applied to the class constructor.
  • methods (Partial<Record<keyof T, MethodDecorator[]>>): decorators per method, applied in order.
  • group (string): group name for x-tagGroups. See Tag groups.
  • tags (string[]): tags associated with the group. Must match ApiTags().

If a method key doesn't exist on the controller at runtime, a warning is logged and that entry is skipped, but the rest of the docs file is still applied.