---
lang: en
title: 'API docs: metadata.metadatainspector.definemetadata'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/metadata
permalink: /doc/en/lb4/apidocs.metadata.metadatainspector.definemetadata.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/metadata](./metadata.md) &gt; [MetadataInspector](./metadata.metadatainspector.md) &gt; [defineMetadata](./metadata.metadatainspector.definemetadata.md)

## MetadataInspector.defineMetadata() method

Define metadata for the given target

**Signature:**

```typescript
static defineMetadata<T>(key: MetadataKey<T, DecoratorType>, value: T, target: Object, member?: string): void;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  key | [MetadataKey](./metadata.metadatakey.md)<!-- -->&lt;T, [DecoratorType](./metadata.decoratortype.md)<!-- -->&gt; | Metadata key |
|  value | T | Metadata value |
|  target | Object | Target for the metadata |
|  member | string | _(Optional)_ Optional property or method name |

**Returns:**

void


