Skip to content

Class: MetadataController ​

Defined in: metadata/metadata.controller.ts:25

MetadataController — serves the $metadata CSDL XML and OData service document.

Routes (relative to serviceRoot, e.g. '/odata'): GET /odata/$metadata → CSDL XML (Content-Type: application/xml) GET /odata → Service document JSON (Content-Type: application/json)

The controller uses @Controller() with no prefix because consumers mount it via ODataModule which sets the serviceRoot path. The routes use the serviceRoot path directly to ensure correct routing when integrated into a NestJS app.

Implementation uses a fixed serviceRoot-relative routing strategy: The @Controller() prefix is set to the serviceRoot and endpoints are '/$metadata' and '/' respectively. This is the most NestJS-idiomatic approach.

Constructors ​

Constructor ​

new MetadataController(csdlBuilder, serviceDocumentBuilder, options): MetadataController

Defined in: metadata/metadata.controller.ts:26

Parameters ​

csdlBuilder ​

CsdlBuilder

serviceDocumentBuilder ​

ServiceDocumentBuilder

options ​

ODataModuleOptions

Returns ​

MetadataController

Properties ​

options ​

readonly options: ODataModuleOptions

Defined in: metadata/metadata.controller.ts:29

Methods ​

getMetadata() ​

getMetadata(): string

Defined in: metadata/metadata.controller.ts:39

GET {serviceRoot}/$metadata Returns OData v4 CSDL XML document. Content-Type: application/xml per OData spec.

Returns ​

string


getServiceDocument() ​

getServiceDocument(): object

Defined in: metadata/metadata.controller.ts:50

GET {serviceRoot}/ (service document) Returns OData service document listing all available EntitySets. Content-Type: application/json per OData spec.

Returns ​

object