---
url: /nestjs-odata/api/generated/classes/ODataQueryPipe.md
---
# Class: ODataQueryPipe

Defined in: [query/odata-query.pipe.ts:44](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/query/odata-query.pipe.ts#L44)

ODataQueryPipe — NestJS PipeTransform that converts the request's query options into a typed,
validated ODataQuery.

Input contract: one entry per query option name with its value **already decoded**, which is
what NestJS gives an `@Query()` parameter (Express's `req.query`, Fastify's `request.query`).
Each option is parsed from its own value and never percent-decoded again, so a value may hold
`&`, `%`, `+` or any other character (`$filter=contains(title,'A & B')`, sent as `%26`). A
system query option given more than once (in any letter case) or with a non-string value is
refused (400). To parse a raw query string, use `parseQueryString`.

Per threat model T-03-01: validates all $filter/$select/$orderby property
references against EdmRegistry. Unknown properties throw ODataValidationError.

Per threat model T-03-03: clamps $top to maxTop from ODataModuleResolvedOptions.

Zero TypeORM imports — per PKG-01 architecture constraint.

## Implements

* `PipeTransform`<[`ODataQueryOptionValues`](../type-aliases/ODataQueryOptionValues.md), [`ODataQuery`](../interfaces/ODataQuery.md)>

## Constructors

### Constructor

> **new ODataQueryPipe**(`edmRegistry`, `options`): `ODataQueryPipe`

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

#### Parameters

##### edmRegistry

[`EdmRegistry`](EdmRegistry.md)

##### options

[`ODataModuleResolvedOptions`](../interfaces/ODataModuleResolvedOptions.md)

#### Returns

`ODataQueryPipe`

## Methods

### transform()

> **transform**(`value`, `metadata`): [`ODataQuery`](../interfaces/ODataQuery.md)

Defined in: [query/odata-query.pipe.ts:50](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/query/odata-query.pipe.ts#L50)

Method to implement a custom pipe.  Called with two parameters

#### Parameters

##### value

[`ODataQueryOptionValues`](../type-aliases/ODataQueryOptionValues.md)

argument before it is received by route handler method

##### metadata

`ArgumentMetadata`

contains metadata about the value

#### Returns

[`ODataQuery`](../interfaces/ODataQuery.md)

#### Implementation of

`PipeTransform.transform`
