fix: wrong property design:type
after Typescript build
#2501
Labels
status: needs triage
Issues which needs to be reproduced to be verified report.
type: fix
Issues describing a broken feature.
Description
When building a file with a class with
class-validator
decorators, the final validation rules are defined by how the types of the property were declared in Typescript.What was working ✅
compiles to
This works, an ISO string is accepted in that parameter. The important part here is that the
design:type
has anObject
value. I will focus the code on that line from now on to avoid repetition.What is not working ❌
Removing the
null
type as one of the possible types of the property.compiles to
With this, when passing an ISO date we receive the error
inspection_date must be a valid ISO 8601 date string
.I know that it shouldn't be a
Date
type, but why is Typescript defining how the validator should work?Expected behavior
Typescript types influences on the validation of properties .
Actual behavior
The only influence should come from the decorators. If I have a mistake in my types I shouldn't receive an
Bad Request
error if the request was actually a valid one.The text was updated successfully, but these errors were encountered: