Skip to content

Function: annotateEntity()

annotateEntity(entity, ctx): Record<string, unknown>

Defined in: packages/core/src/response/odata-annotation.builder.ts:66

Annotate a single entity object with OData v4 metadata annotations.

Adds:

  • @odata.id — canonical URL for the entity (RESP-04)
  • @odata.type — qualified type name with namespace prefix (RESP-05)
  • {navProp}@odata.navigationLink — for each navigation property (RESP-06)

Returns the entity unchanged if it is null, undefined, or not an object.

This function is pure — it never mutates the input entity.

Parameters

entity

Record<string, unknown>

The entity object to annotate

ctx

AnnotationContext

The annotation context (service root, entity set name, entity type, namespace)

Returns

Record<string, unknown>