MCPcopy
hub / github.com/FoalTS/foal / AddMetadataProperty

Function AddMetadataProperty

packages/core/src/core/openapi/decorators.ts:23–31  ·  view source on GitHub ↗
(metadataKey: string, key: string, property: any)

Source from the content-addressed store, hash-verified

21}
22
23function AddMetadataProperty(metadataKey: string, key: string, property: any) {
24 return (target: any, propertyKey?: string) => {
25 // Note that propertyKey can be undefined as it's an optional parameter in getMetadata.
26 let o = Reflect.getMetadata(metadataKey, target, propertyKey as string) || {};
27 o = Object.assign({}, o);
28 o[key] = property;
29 Reflect.defineMetadata(metadataKey, o, target, propertyKey as string);
30 };
31}
32
33export function ApiInfo(info: IApiInfo | ((controller: any) => IApiInfo)): OpenApiDecorator {
34 return Reflect.metadata('api:document:info', info);

Callers 11

ApiResponseFunction · 0.85
ApiCallbackFunction · 0.85
ApiDefineSchemaFunction · 0.85
ApiDefineResponseFunction · 0.85
ApiDefineParameterFunction · 0.85
ApiDefineExampleFunction · 0.85
ApiDefineRequestBodyFunction · 0.85
ApiDefineHeaderFunction · 0.85
ApiDefineSecuritySchemeFunction · 0.85
ApiDefineLinkFunction · 0.85
ApiDefineCallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected