@nestia/core
Version:
Super-fast validation decorators of NestJS
31 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwaggerCustomizer = SwaggerCustomizer;
/**
* Swagger customization decorator.
*
* `SwaggerCustomizer` is a method decorator function which can used for
* customizing the swagger data with `npx nestia swagger` command. Furthermore,
* it is possible to add plugin properties starting with `x-` characters.
*
* In other words, this decorator function does not affect to the runtime, but
* only for the swagger data customization.
*
* @author Jeongho Nam - https://github.com/samchon
* @param closure Callback function which can customize the swagger data
* @returns Method decorator
*/
function SwaggerCustomizer(closure) {
return function SwaggerCustomizer(target, propertyKey, descriptor) {
const array = (() => {
if (Reflect.hasMetadata("nestia/SwaggerCustomizer", target, propertyKey))
return Reflect.getMetadata("nestia/SwaggerCustomizer", target, propertyKey);
const array = [];
Reflect.defineMetadata("nestia/SwaggerCustomizer", array, target, propertyKey);
return array;
})();
array.push(closure);
return descriptor;
};
}
//# sourceMappingURL=SwaggerCustomizer.js.map