@nestia/sdk
Version:
Nestia SDK and Swagger generator
23 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperationMetadata = OperationMetadata;
/**
* Carries the compile-time operation metadata the SDK / Swagger / e2e
* generators read through `Reflect.getMetadata("nestia/OperationMetadata")`.
*
* The `@nestia/sdk` native transform injects this decorator as a synthesized
* AST node, so its argument is a single JSON string literal rather than an
* object literal — keeping the constructed node tree minimal. The string is
* parsed once here at module-evaluation time. A pre-parsed `IOperationMetadata`
* object is still accepted for hand-written or test usage.
*/
function OperationMetadata(metadata) {
const parsed = typeof metadata === "string"
? JSON.parse(metadata)
: metadata;
return function OperationMetadata(target, propertyKey, descriptor) {
Reflect.defineMetadata("nestia/OperationMetadata", parsed, target, propertyKey);
return descriptor;
};
}
//# sourceMappingURL=OperationMetadata.js.map