-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Groups are not used when performing transforms in validation.pipe #1374
Comments
See here: const entity = classTransformer.plainToClass(
metatype,
this.toEmptyIfNil(value),
);
const errors = await classValidator.validate(entity, this.validatorOptions); Validation options are passed to the |
allows plainToClass to expose class properties to defined groups as per issue nestjs#1374
allows plainToClass to expose class properties to defined groups as per issue nestjs#1374
allows plainToClass to expose class properties to defined groups as per issue nestjs#1374
allows plainToClass to expose class properties to defined groups as per issue nestjs#1374
Available in 5.6.1 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
Groups are not used when performing transforms in validation.pipe
Expected behavior
The transform method respects the group(s) that are passed in the ValidatorOptions
Minimal reproduction of the problem with instructions
I have several modules in different containers, communicating over http. I want to be able to create a MyClass object with properties "visibleToAll" and "visibleToInternal" in the publicly-visible endpoint, send this around my other modules via http (each with a main.ts as below), and then return the object to the web front end with the "visibleToInternal" property stripped.
interface.ts
all modules main.ts
But when I post the object to another module, it hits the validation.pipe transform() method, where the groups attribute isn't being used in the classtoPlain and plainToClass transformations, so even internally, I only have access to the "visibleToAll" property, as the "visibleToInternal" property is being stripped.
What is the motivation / use case for changing the behavior?
As above
Environment
The text was updated successfully, but these errors were encountered: