OpraNestUtils
Utility class for OPRA–NestJS integration. Provides helpers for propagating OPRA decorator metadata from source classes to generated NestJS controller classes.
import { OpraNestUtils } from '@opra/nestjs';
Static methods
copyDecoratorMetadata
static copyDecoratorMetadata(target: Type, ...source: Type[]): void
Copies OPRA-related reflect-metadata entries (keys prefixed with 'opra.') from each source class to the target class, without overwriting existing keys on the target. Also merges NestJS guards (__guards__), interceptors (__interceptors__), and exception filters (__exceptionFilters__) from source classes into the target.
| Parameter | Type | Description |
|---|---|---|
target | Type | The class to receive the metadata. |
...source | Type[] | One or more classes to copy metadata from. |
Example
import { OpraNestUtils } from '@opra/nestjs';
OpraNestUtils.copyDecoratorMetadata(GeneratedController, OriginalController);
This is used internally by @opra/nestjs-http when it generates NestJS controller classes from OPRA HttpController definitions — OPRA metadata (operation shapes, parameter declarations) and NestJS guard/interceptor metadata from the original controller class are copied onto each generated controller.