You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To disable `class-transformer` on a per-controller or per-route basis, use the `transformRequest` and `transformResponse` options on your controller and route decorators:
You can use any existing express / koa middleware, or create your own.
@@ -1210,7 +1234,7 @@ If its a class - then instance of this class will be created.
1210
1234
This technique works with `@Body`, `@Param`, `@QueryParam`, `@BodyParam`, and other decorators.
1211
1235
Learn more about class-transformer and how to handle more complex object constructions [here][4].
1212
1236
This behaviour is enabled by default.
1213
-
If you want to disable it simply pass `classTransformer: false` to createExpressServer method.
1237
+
If you want to disable it simply pass `classTransformer: false` to createExpressServer method. Alternatively you can disable transforming for [individual controllers or routes](#selectively-disable-requestresponse-transforming).
1214
1238
1215
1239
## Auto validating action params
1216
1240
@@ -1264,7 +1288,7 @@ export class UserController {
1264
1288
}
1265
1289
```
1266
1290
If the param doesn't satisfy the requirements defined by class-validator decorators,
1267
-
an error will be thrown and captured by routing-controller, so the client will receive 400 Bad Request and JSON with nice detailed [Validation errors](https://github.com/pleerock/class-validator#validation-errors) array.
1291
+
an error will be thrown and captured by routing-controller, so the client will receive 400 Bad Request and JSON with nice detailed [Validation errors](https://github.com/typestack/class-validator#validation-errors) array.
1268
1292
1269
1293
If you need special options for validation (groups, skipping missing properties, etc.) or transforming (groups, excluding prefixes, versions, etc.), you can pass them as global config as `validation` in createExpressServer method or as a local `validate` setting for method parameter - `@Body({ validate: localOptions })`.
1270
1294
@@ -1486,7 +1510,8 @@ export class QuestionController {
0 commit comments