Skip to content

Function: buildContextUrl()

buildContextUrl(serviceRoot, entitySetName, select?, isSingleEntity?): string

Defined in: packages/core/src/response/odata-context-url.builder.ts:18

Builds the OData v4 @odata.context URL per spec section 10.

Format: {serviceRoot}/$metadata#{entitySetName}[(field1,field2,...)] Single-entity format: {serviceRoot}/$metadata#{entitySetName}/$entity

Per D-07: when $select has specific items (not all, not undefined), a select projection suffix is appended. Per D-05: when isSingleEntity is true, /$entity suffix is appended.

Parameters

serviceRoot

string

The OData service root path (e.g. '/odata')

entitySetName

string

The name of the entity set (e.g. 'Products')

select?

SelectNode

Optional SelectNode from the parsed query

isSingleEntity?

boolean

When true, appends /$entity suffix for single-entity responses

Returns

string