Kind: Interface
Source: packages/core/helpers/interfaces/params-metadata.interface.ts
Part of: Core
ParamMetadata describes metadata for a single parameter in a handler, resolver, or decorated method. It stores the parameter's positional index and associated data, allowing the framework to resolve and inject the correct value at runtime.
Properties
| Property | Type |
|---|---|
index | number |
data | ParamData |
Diagram
mermaidgraph LR Handler[Handler Method] --> Params[Parameter List] Params --> Metadata[ParamMetadata] Metadata --> Index[index: number] Metadata --> Data[data: ParamData] Metadata --> Resolver[Parameter Resolver]
Usage
tsimport type { ParamMetadata } from './helpers/interfaces/params-metadata.interface';
const userIdParam: ParamMetadata = {
index: 0,
data: {
name: 'userId',
type: 'param',
},
};
function resolveParameter(metadata: ParamMetadata, request: Request) {
if (metadata.data.type === 'param') {
return request.params[metadata.data.name];
}
return undefined;
}
const userId = resolveParameter(userIdParam, request);
AI Coding Instructions
- Keep
indexaligned with the parameter's zero-based position in the target method signature. - Use the appropriate
ParamDatashape when creating metadata; avoid replacing it with untyped objects. - Preserve parameter metadata ordering when collecting metadata for a method or resolver.
- Use
ParamMetadatawith the parameter-resolution pipeline rather than reading request or context values directly in framework internals.
Was this page helpful?