Closed CaffeineDuck closed 1 year ago
Partial<...>
is a Typescript option, so it will generate a new class with all attributes set to optional as indicated with a "?" (like title?: string
).
However, class-validator does not use that Typescript "?" to determine whether an attribute is optional; you have to use the @IsOptional()
decorator to indicate this, which is not generated by Partial/'?' from the core Typescript functionality.
How do I make it work with optional attributes? The validator is checking it regardless of the attribute being optional.
Error when I run try to validate UpdateEventDto body:
The API Input: