class-transformer Questions
1
I used the class-transformer library in my project implemented on NodeJS, but I did not find a way to expose all the properties of my entity.
I tried using the @Expose() decorator at class level, b...
Strobila asked 6/8, 2021 at 18:44
3
Solved
I'm trying to find a nice way to validate a body using DTO (using the brilliant class-validator and class-transformer libraries). It works really well, even for nested structures but in my case I'd...
Monseigneur asked 5/1, 2019 at 22:47
3
Solved
Is there a way to set the execution order of decorators when describing a DTO class in NestJS using class-validator and class-transformer packages ?
Following code fails when the value of foo is se...
Yakka asked 7/9, 2021 at 8:39
7
Solved
I'm new to NestJS and I am trying to fill a filter DTO from query Parameters.
Here is what I have:
Query:
localhost:3000/api/checklists?stations=114630,114666,114667,114668
Controller
@Get()
p...
Stere asked 11/12, 2019 at 16:1
1
I have a NestJS project in which I'm using both class validator and class transformer, and I need the class-transformer to execute before the class-validator throws an error.
Given the following c...
Eatables asked 12/12, 2019 at 17:22
3
Solved
I have a nodejs REST API backend running the nestjs framework, using typeORM as ORM for my entities.
Coming from a C#/Entity Framework background, I am very used to have my Dtos mapped to the data...
Edita asked 30/6, 2018 at 9:13
9
Consider this endpoint in my API:
@Post('/convert')
@UseInterceptors(FileInterceptor('image'))
convert(
@UploadedFile() image: any,
@Body(
new ValidationPipe({
validationError: {
target: fa...
Erdrich asked 26/11, 2019 at 8:28
4
How to transform database entity User:
class User {
public firstName: string;
public lastName: string;
public phone?: string;
public email: string;
public status: EUserState;
public tokens: ...
Gybe asked 9/2, 2020 at 18:6
3
Solved
I'm using the built in NestJS ValidationPipe along with class-validator and class-transformer to validate and sanitize inbound JSON body payloads. One scenario I'm facing is a mixture of upper and ...
Swamy asked 29/12, 2020 at 3:24
5
Solved
I've a simple user model and i want to exclude password from it. Using the official docs and answer here i've tried to make it work but this doesn't seem to work as i get a response something like ...
Flexor asked 13/1, 2020 at 14:13
2
Solved
I have a DTO in which I have a field which is an array of numbers. These ids are coming via API query parameters. I am using Class Transformer to transform these ids into an array of numbers. But I...
Hamamatsu asked 23/10, 2020 at 6:12
2
Exclude undefined or null properties from the class. this is actual nature but I need a decorator who can ignore this
import {Expose, plainToClass} from "class-transformer";
class User {
@Expose...
Hemostat asked 5/3, 2020 at 10:9
2
Solved
I am trying to serialize nested objects using a class transformer. I have two dtos like below. When I am trying to serialize using plainToClass the nested object gets removed from the output. only ...
Harriettharrietta asked 2/7, 2022 at 5:40
2
Solved
When I went through Pipes documentation I noticed that I can't make @IsInt() validation for application/x-www-form-urlencoded request correctly, cause all values which I passed I receive as string ...
Repellent asked 25/2, 2018 at 20:55
3
Solved
I have been trying to work through the NestJs example for the Serialization Section for Mongodb using Typegoose using the class-transformer library. The example given at https://docs.nestjs.com/tec...
Squiggle asked 4/3, 2020 at 11:59
1
Solved
I am not able to expose an array of objects.
The Followers array is not getting exposed, even though I exposed in the UserDto
this is what I am getting,
{
"id": "5ff4ec30-d3f4-43d3-...
Werbel asked 11/8, 2021 at 14:40
4
Solved
I want to serialize a controller response by the nestjs serialization technique. I didn't find any approach and my solution is as follows:
User Entity
export type UserRoleType = "admin" | "editor...
Multiflorous asked 12/2, 2019 at 14:33
2
Solved
I'm trying to use the library class-transformer(https://github.com/typestack/class-transformer) to serialize typescript classes to firebase, which doesn't accept customs types.
The thing is some of...
Dora asked 16/3, 2021 at 20:25
1
Solved
I am trying to validate that the headers of the request contain some specific data, and I am using NestJS. I found this information. While this is what I want to do, and it looks proper, the ClassT...
Haematoxylin asked 31/3, 2021 at 2:14
0
I am trying to use the class-transformer package with NestJS v7. The class-transformer package was installed with npm i class-transformer --save. I've followed instructions as per readme.md
This pa...
Rodrickrodrigez asked 10/8, 2020 at 22:31
1
Solved
I want to achieve automatic serialization/deserialization of JSON request/response body for NestJS controllers, to be precise, automatically convert snake_case request body JSON keys to camelCase r...
Octonary asked 19/7, 2020 at 12:8
1
Solved
Currently I use the class-transformer package to transform optional values to default values
@IsString()
@IsOptional()
@Transform((description: string) => description || '')
public description:...
Tybalt asked 21/4, 2020 at 6:21
1
Solved
The class-transformer docs say:
Implicit type conversion
NOTE If you use class-validator together with class-transformer you propably DON'T want to enable this function.
Why not?
I did some...
Holiday asked 30/12, 2019 at 13:9
2
Solved
Edit:
I have looked at this question/answer How to exclude entity field from controller json
But, as per below - this is excluding that field from all queries (to the porint where when trying to pr...
Restaurateur asked 23/1, 2019 at 13:37
1
Solved
When using
@UseInterceptors(ClassSerializerInterceptor)
like it is explained in the Documentation here
I get the desired filtered result, however while using mongodb the id is formatted in _bso...
Leeway asked 20/2, 2019 at 3:5
1 Next >
© 2022 - 2025 — McMap. All rights reserved.