---
url: /nestjs-odata/api/generated/interfaces/ODataModuleOptions.md
---
# Interface: ODataModuleOptions

Defined in: [odata.module.ts:37](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L37)

Configuration options for ODataModule.forRoot().

Per threat model T-02-03: serviceRoot must be a non-empty string.
Per threat model T-02-04: maxTop and maxExpandDepth have safe defaults.

## Properties

### controllers?

> `optional` **controllers?**: (new (...`args`) => `any`)\[]

Defined in: [odata.module.ts:91](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L91)

OData controller classes decorated with @ODataController().
Per D-17: forRoot() patches each controller's PATH_METADATA to prepend serviceRoot synchronously,
before NestJS compiles the module. Controllers not listed here will NOT have serviceRoot applied.

#### Parameters

##### args

...`any`\[]

#### Returns

`any`

***

### errorLanguage?

> `optional` **errorLanguage?**: `string`

Defined in: [odata.module.ts:75](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L75)

Language of error messages, an RFC 5646 tag sent as `Content-Language` on every error
response and `$batch` error part (OData-Protocol 4.01 §9.4). Default: `'en'` (the language
of the library's own messages). An `errorMapper` result may set its own `language`.

***

### errorMapper?

> `optional` **errorMapper?**: [`ODataErrorMapper`](../type-aliases/ODataErrorMapper.md)

Defined in: [odata.module.ts:69](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L69)

Maps any exception thrown by an OData route (or a `$batch` operation) to an OData error:
HTTP status, code, message and optional target, details and innererror. Return
`undefined` to use the default mapping. See [ODataErrorMapper](../type-aliases/ODataErrorMapper.md).

***

### ignoreUnknownProperties?

> `optional` **ignoreUnknownProperties?**: `boolean`

Defined in: [odata.module.ts:84](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L84)

Accept and drop write-body properties that are not in the entity type, instead of
answering 400 Bad Request. Default: false.

OData-Protocol 4.01 §11.4.2: a service MUST fail a create or update when it cannot persist
a property of the request, so unknown properties are refused by default. Enable this only
for clients you cannot fix that send extra fields; the values are never persisted.

***

### maxDeepInsertDepth?

> `optional` **maxDeepInsertDepth?**: `number`

Defined in: [odata.module.ts:54](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L54)

Maximum nesting depth for deep insert POST bodies. Default: 5.
Per T-10-05: prevents denial-of-service via unbounded recursion.

***

### maxExpandDepth?

> `optional` **maxExpandDepth?**: `number`

Defined in: [odata.module.ts:45](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L45)

Maximum depth of $expand nesting. Default: 2

***

### maxFilterDepth?

> `optional` **maxFilterDepth?**: `number`

Defined in: [odata.module.ts:47](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L47)

Maximum nesting depth of $filter expressions. Default: 10 (per SEC-04)

***

### maxTop?

> `optional` **maxTop?**: `number`

Defined in: [odata.module.ts:43](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L43)

Maximum number of entities returned per query. Default: 1000

***

### namespace?

> `optional` **namespace?**: `string`

Defined in: [odata.module.ts:41](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L41)

EDM namespace for all entity types. Default: 'Default' (per D-08)

***

### requireScope?

> `optional` **requireScope?**: `boolean`

Defined in: [odata.module.ts:63](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L63)

Fail closed when an entity set has no row-level scope. Default: false.

When true, adapters that support row-level scopes (the TypeORM adapter's `scope` option)
refuse to start when an entity set they register has no scope, and refuse at request time
to read or write an entity set without one, including entity sets reached through
`$expand` or a lambda (`any`/`all`) in `$filter`.

***

### serviceRoot

> **serviceRoot**: `string`

Defined in: [odata.module.ts:39](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L39)

Base path for the OData service, e.g. '/odata'

***

### unmappedTypeStrategy?

> `optional` **unmappedTypeStrategy?**: [`UnmappedTypeStrategy`](../type-aliases/UnmappedTypeStrategy.md)

Defined in: [odata.module.ts:49](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/odata.module.ts#L49)

Strategy when a TypeScript type cannot be mapped to an EDM primitive. Default: 'skip' (per D-10)
